Example usage for Java java.util.prefs Preferences fields, constructors, methods, implement or subclass
The text is from its open source code.
int | MAX_KEY_LENGTH Maximum length of string allowed as a key (80 characters). |
int | MAX_VALUE_LENGTH Maximum length of string allowed as a value (8192 characters). |
int | MAX_NAME_LENGTH Maximum length of a node name (80 characters). |
String | absolutePath() Returns this preference node's absolute path name. |
void | addNodeChangeListener(NodeChangeListener ncl) Registers the specified listener to receive node change events for this node. |
void | addPreferenceChangeListener(PreferenceChangeListener pcl) Registers the specified listener to receive preference change events for this preference node. |
String[] | childrenNames() Returns the names of the children of this preference node, relative to this node. |
void | clear() Removes all of the preferences (key-value associations) in this preference node. |
void | exportNode(OutputStream os) Emits on the specified output stream an XML document representing all of the preferences contained in this node (but not its descendants). |
void | exportSubtree(OutputStream os) Emits an XML document representing all of the preferences contained in this node and all of its descendants. |
void | flush() Forces any changes in the contents of this preference node and its descendants to the persistent store. |
String | get(String key, String def) Returns the value associated with the specified key in this preference node. |
boolean | getBoolean(String key, boolean def) Returns the boolean value represented by the string associated with the specified key in this preference node. |
byte[] | getByteArray(String key, byte[] def) Returns the byte array value represented by the string associated with the specified key in this preference node. |
Class> | getClass() Returns the runtime class of this Object . |
double | getDouble(String key, double def) Returns the double value represented by the string associated with the specified key in this preference node. |
float | getFloat(String key, float def) Returns the float value represented by the string associated with the specified key in this preference node. |
int | getInt(String key, int def) Returns the int value represented by the string associated with the specified key in this preference node. |
long | getLong(String key, long def) Returns the long value represented by the string associated with the specified key in this preference node. |
void | importPreferences(InputStream is) Imports all of the preferences represented by the XML document on the specified input stream. |
boolean | isUserNode() Returns true if this preference node is in the user preference tree, false if it's in the system preference tree. |
String[] | keys() Returns all of the keys that have an associated value in this preference node. |
String | name() Returns this preference node's name, relative to its parent. |
Preferences | node(String pathName) Returns the named preference node in the same tree as this node, creating it and any of its ancestors if they do not already exist. |
boolean | nodeExists(String pathName) Returns true if the named preference node exists in the same tree as this node. |
Preferences | parent() Returns the parent of this preference node, or null if this is the root. |
void | put(String key, String value) Associates the specified value with the specified key in this preference node. |
void | putBoolean(String key, boolean value) Associates a string representing the specified boolean value with the specified key in this preference node. |
void | putByteArray(String key, byte[] value) Associates a string representing the specified byte array with the specified key in this preference node. |
void | putDouble(String key, double value) Associates a string representing the specified double value with the specified key in this preference node. |
void | putFloat(String key, float value) Associates a string representing the specified float value with the specified key in this preference node. |
void | putInt(String key, int value) Associates a string representing the specified int value with the specified key in this preference node. |
void | putLong(String key, long value) Associates a string representing the specified long value with the specified key in this preference node. |
void | remove(String key) Removes the value associated with the specified key in this preference node, if any. |
void | removeNode() Removes this preference node and all of its descendants, invalidating any preferences contained in the removed nodes. |
void | removePreferenceChangeListener(PreferenceChangeListener pcl) Removes the specified preference change listener, so it no longer receives preference change events. |
void | sync() Ensures that future reads from this preference node and its descendants reflect any changes that were committed to the persistent store (from any VM) prior to the sync invocation. |
Preferences | systemNodeForPackage(Class> c) Returns the preference node from the system preference tree that is associated (by convention) with the specified class's package. |
Preferences | systemRoot() Returns the root preference node for the system. |
Preferences | userNodeForPackage(Class> c) Returns the preference node from the calling user's preference tree that is associated (by convention) with the specified class's package. |
Preferences | userRoot() Returns the root preference node for the calling user. |