org.tentackle.util
Class PreferencesSupport
java.lang.Object
org.tentackle.util.PreferencesSupport
public class PreferencesSupport
- extends Object
Generic Preferences support.
- XML import/export (cause java.util.prefs.XmlSupport is package scope)
- probably more in the future ;-)
As opposed to Suns implementation, tentackle preferences work with all
Preferences, not only AbstractPreferences.
This code is largely copied from Sun and only slightly modified,
so it's probably not legal to put it under LGPL...
- Author:
- harald
|
Method Summary |
static void |
export(OutputStream os,
Preferences prefs,
boolean subTree)
Export the specified preferences node and, if subTree is true, all
subnodes, to the specified output stream. |
static void |
importPreferences(InputStream is)
Import preferences from the specified input stream, which is assumed
to contain an XML document in the format described in the Preferences
spec. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PreferencesSupport
public PreferencesSupport()
importPreferences
public static void importPreferences(InputStream is)
throws IOException,
InvalidPreferencesFormatException
- Import preferences from the specified input stream, which is assumed
to contain an XML document in the format described in the Preferences
spec.
- Parameters:
is - the input stream
- Throws:
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.
export
public static void export(OutputStream os,
Preferences prefs,
boolean subTree)
throws IOException,
BackingStoreException
- Export the specified preferences node and, if subTree is true, all
subnodes, to the specified output stream. Preferences are exported as
an XML document conforming to the definition in the Preferences spec.
- Parameters:
os - the output streamprefs - the preferencessubTree - true if with subtree
- Throws:
IOException - if writing to the specified output stream
results in an IOException.
BackingStoreException - if preference data cannot be read from
backing store.
IllegalStateException - if this node (or an ancestor) has been
removed with the Preferences.removeNode() method.
Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de