public class MemoryPreferences extends AbstractPreferences
| Modifier and Type | Field and Description |
|---|---|
protected MemoryPreferences |
myparent |
protected Map<String,Preferences> |
nodes |
static int |
SYSTEM_NODE |
static int |
USER_NODE |
lock, newNodeMAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH| Modifier | Constructor and Description |
|---|---|
protected |
MemoryPreferences(MemoryPreferences parent,
String name)
Creates a preference node with the specified parent and the specified
name relative to its parent.
|
protected |
MemoryPreferences(String name)
create a new user Node NetworkPreferences.
|
| Modifier and Type | Method and Description |
|---|---|
protected String[] |
childrenNamesSpi()
Returns the names of the children of this preference node.
|
protected AbstractPreferences |
childSpi(String name)
Returns the named child of this preference node, creating it if it does
not already exist.
|
void |
exportNode(OutputStream os)
Implements the exportNode method as per the specification in
Preferences.exportNode(OutputStream). |
void |
exportSubtree(OutputStream os)
Implements the exportSubtree method as per the specification in
Preferences.exportSubtree(OutputStream). |
void |
flush() |
protected void |
flushSpi()
Empty, never used implementation of AbstractPreferences.flushSpi().
|
Object |
getLock() |
protected Map |
getMapImpl()
return the backstore Hashtable implementation for the (key, value) map.
|
protected Map |
getNodeImpl()
return the backstore Hashtable implementation for the nodes.
|
protected String |
getSpi(String key)
Return the value associated with the specified key at this preference
node, or null if there is no association for this key, or the
association cannot be determined at this time.
|
static void |
importPreferences(InputStream is)
Imports all of the preferences represented by the XML document on the
specified input stream.
|
boolean |
isInRemoveLock() |
boolean |
isUserNode() |
protected String[] |
keysSpi()
Returns all of the keys that have an associated value in this
preference node.
|
Preferences |
node(String name) |
void |
put(String key,
String value) |
protected void |
putSpi(String key,
String value)
Put the given key-value association into this preference node.
|
protected void |
removeNodeSpi()
Removes this preference node, invalidating it and any preferences that
it contains.
|
protected void |
removeSpi(String key)
Remove the association (if any) for the specified key at this
preference node.
|
void |
sync()
Identical to flush().
|
protected void |
syncSpi()
Empty, never used implementation of AbstractPreferences.syncSpi().
|
static Preferences |
systemNodeForPackage(Class c) |
static Preferences |
userNodeForPackage(Class c) |
absolutePath, addNodeChangeListener, addPreferenceChangeListener, cachedChildren, childrenNames, clear, get, getBoolean, getByteArray, getChild, getDouble, getFloat, getInt, getLong, isRemoved, keys, name, nodeExists, parent, putBoolean, putByteArray, putDouble, putFloat, putInt, putLong, remove, removeNode, removeNodeChangeListener, removePreferenceChangeListener, toStringsystemNodeForPackage, systemRoot, userNodeForPackage, userRootpublic static final int USER_NODE
public static final int SYSTEM_NODE
protected MemoryPreferences myparent
protected Map<String,Preferences> nodes
protected MemoryPreferences(String name)
protected MemoryPreferences(MemoryPreferences parent, String name)
parent - the parent of this preference node, or null if this
is the root.name - the name of this preference node, relative to its parent,
or "" if this is the root.IllegalArgumentException - if name contains a slash
('/'), or parent is null and
name isn't "".protected void putSpi(String key, String value)
putSpi in class AbstractPreferencespublic void put(String key, String value)
put in class AbstractPreferencesprotected String getSpi(String key)
getSpi in class AbstractPreferencesprotected void removeSpi(String key)
removeSpi in class AbstractPreferencesprotected void removeNodeSpi()
throws BackingStoreException
Preferences.removeNode() method
invokes this method repeatedly in a bottom-up fashion, removing each of
a node's descendants before removing the node itself).
The removal of a node will not become persistent until the flush method is invoked on this node (or an ancestor).
removeNodeSpi in class AbstractPreferencesBackingStoreException - if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.protected String[] keysSpi() throws BackingStoreException
If this node throws a BackingStoreException, the exception
will propagate out beyond the enclosing AbstractPreferences.keys() invocation.
keysSpi in class AbstractPreferencesBackingStoreException - if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.protected String[] childrenNamesSpi() throws BackingStoreException
If this node throws a BackingStoreException, the exception
will propagate out beyond the enclosing AbstractPreferences.childrenNames()
invocation.
childrenNamesSpi in class AbstractPreferencesBackingStoreException - if this operation cannot be completed
due to a failure in the backing store, or inability to
communicate with it.protected AbstractPreferences childSpi(String name)
childSpi in class AbstractPreferencesname - The name of the child node to return, relative to
this preference node.protected void syncSpi()
throws BackingStoreException
syncSpi in class AbstractPreferencesBackingStoreExceptionpublic void sync()
throws BackingStoreException
sync in class AbstractPreferencesBackingStoreExceptionprotected void flushSpi()
throws BackingStoreException
flushSpi in class AbstractPreferencesBackingStoreExceptionpublic void flush()
throws BackingStoreException
flush in class AbstractPreferencesBackingStoreExceptionpublic boolean isUserNode()
isUserNode in class AbstractPreferencespublic Object getLock()
public boolean isInRemoveLock()
public void exportNode(OutputStream os) throws IOException, BackingStoreException
Preferences.exportNode(OutputStream).exportNode in class AbstractPreferencesos - the output stream on which to emit the XML document.IOException - if writing to the specified output stream
results in an IOException.BackingStoreException - if preference data cannot be read from
backing store.public void exportSubtree(OutputStream os) throws IOException, BackingStoreException
Preferences.exportSubtree(OutputStream).exportSubtree in class AbstractPreferencesos - the output stream on which to emit the XML document.IOException - if writing to the specified output stream
results in an IOException.BackingStoreException - if preference data cannot be read from
backing store.public static void importPreferences(InputStream is) throws IOException, InvalidPreferencesFormatException
is - the input stream from which to read the XML document.IOException - if reading from the specified output stream
results in an IOException.InvalidPreferencesFormatException - Data on input stream does not
constitute a valid XML document with the mandated document type.public static Preferences userNodeForPackage(Class c)
public static Preferences systemNodeForPackage(Class c)
protected Map getNodeImpl()
protected Map getMapImpl()
public Preferences node(String name)
node in class AbstractPreferences