org.tentackle.util
Class PreferencesSupport

java.lang.Object
  extended by org.tentackle.util.PreferencesSupport

public class PreferencesSupport
extends Object

Generic Preferences support.

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

Constructor Summary
PreferencesSupport()
           
 
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
 

Constructor Detail

PreferencesSupport

public PreferencesSupport()
Method Detail

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 stream
prefs - the preferences
subTree - 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