Java java.util.prefs Preferences fields, constructors, methods, implement or subclass

Example usage for Java java.util.prefs Preferences fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.util.prefs Preferences.

The text is from its open source code.

Subclass

java.util.prefs.Preferences has subclasses.
Click this link to see all its subclasses.

Field

intMAX_KEY_LENGTH
Maximum length of string allowed as a key (80 characters).
intMAX_VALUE_LENGTH
Maximum length of string allowed as a value (8192 characters).
intMAX_NAME_LENGTH
Maximum length of a node name (80 characters).

Method

StringabsolutePath()
Returns this preference node's absolute path name.
voidaddNodeChangeListener(NodeChangeListener ncl)
Registers the specified listener to receive node change events for this node.
voidaddPreferenceChangeListener(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.
voidclear()
Removes all of the preferences (key-value associations) in this preference node.
voidexportNode(OutputStream os)
Emits on the specified output stream an XML document representing all of the preferences contained in this node (but not its descendants).
voidexportSubtree(OutputStream os)
Emits an XML document representing all of the preferences contained in this node and all of its descendants.
voidflush()
Forces any changes in the contents of this preference node and its descendants to the persistent store.
Stringget(String key, String def)
Returns the value associated with the specified key in this preference node.
booleangetBoolean(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.
ClassgetClass()
Returns the runtime class of this Object .
doublegetDouble(String key, double def)
Returns the double value represented by the string associated with the specified key in this preference node.
floatgetFloat(String key, float def)
Returns the float value represented by the string associated with the specified key in this preference node.
intgetInt(String key, int def)
Returns the int value represented by the string associated with the specified key in this preference node.
longgetLong(String key, long def)
Returns the long value represented by the string associated with the specified key in this preference node.
voidimportPreferences(InputStream is)
Imports all of the preferences represented by the XML document on the specified input stream.
booleanisUserNode()
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.
Stringname()
Returns this preference node's name, relative to its parent.
Preferencesnode(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.
booleannodeExists(String pathName)
Returns true if the named preference node exists in the same tree as this node.
Preferencesparent()
Returns the parent of this preference node, or null if this is the root.
voidput(String key, String value)
Associates the specified value with the specified key in this preference node.
voidputBoolean(String key, boolean value)
Associates a string representing the specified boolean value with the specified key in this preference node.
voidputByteArray(String key, byte[] value)
Associates a string representing the specified byte array with the specified key in this preference node.
voidputDouble(String key, double value)
Associates a string representing the specified double value with the specified key in this preference node.
voidputFloat(String key, float value)
Associates a string representing the specified float value with the specified key in this preference node.
voidputInt(String key, int value)
Associates a string representing the specified int value with the specified key in this preference node.
voidputLong(String key, long value)
Associates a string representing the specified long value with the specified key in this preference node.
voidremove(String key)
Removes the value associated with the specified key in this preference node, if any.
voidremoveNode()
Removes this preference node and all of its descendants, invalidating any preferences contained in the removed nodes.
voidremovePreferenceChangeListener(PreferenceChangeListener pcl)
Removes the specified preference change listener, so it no longer receives preference change events.
voidsync()
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.
PreferencessystemNodeForPackage(Class c)
Returns the preference node from the system preference tree that is associated (by convention) with the specified class's package.
PreferencessystemRoot()
Returns the root preference node for the system.
PreferencesuserNodeForPackage(Class c)
Returns the preference node from the calling user's preference tree that is associated (by convention) with the specified class's package.
PreferencesuserRoot()
Returns the root preference node for the calling user.