
com.asprise.ocr.sample.util.prefs.FileSystemPreferencesFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-ocr-api Show documentation
Show all versions of java-ocr-api Show documentation
A Java OCR SDK Library API allows you to perform OCR and bar code recognition on images (JPEG, PNG, TIFF, PDF, etc.) and output as plain text, xml with full coordinate, searchable PDF or editable RTF.
/**********************************************************************************************
*
* Asprise OCR Java API
* Copyright (C) 1998-2015. Asprise Inc.
*
* This file is licensed under the GNU Affero General Public License version 3 as published by
* the Free Software Foundation.
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*
* You should have received a copy of the GNU Affero General Public License. If not, please
* visit .
*
**********************************************************************************************/
package com.asprise.ocr.sample.util.prefs;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
import java.util.prefs.PreferencesFactory;
public class FileSystemPreferencesFactory implements PreferencesFactory {
public Preferences userRoot() {
return FileSystemPreferences.getUserRoot();
}
public Preferences systemRoot() {
return FileSystemPreferences.getSystemRoot();
}
public static void main(String[] args) throws BackingStoreException {
Preferences prefs = new FileSystemPreferencesFactory().userRoot().node(String.class.getName());
String name = prefs.get("NAME", null);
int age = prefs.getInt("AGE", -1);
boolean isMale = prefs.getBoolean("MALE", false);
System.out.println(name + "/" + age + "/" + isMale);
prefs.put("NAME", "Homer");
prefs.putInt("AGE", 45);
prefs.putBoolean("MALE", true);
prefs.flush();
System.out.println("Done.");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy