XML : Does Preferences.importPreferences erase preferences?

I am wondering if the java method Preferences.importPreferences(InputStream is) will erase Preferences that do not exist on the Preferences being imported.

The Javadocs:

Imports all of the preferences represented by the XML document on the specified input stream. The document may represent user preferences or system preferences. If it represents user preferences, the preferences will be imported into the calling user's preference tree (even if they originally came from a different user's preference tree). If any of the preferences described by the document inhabit preference nodes that do not exist, the nodes will be created.

The XML document must have the following DOCTYPE declaration:

  <!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">    

(This method is designed for use in conjunction with Preferences.exportNode(OutputStream) and Preferences.exportSubtree(OutputStream).

This method is an exception to the general rule that the results of concurrently executing multiple methods in this class yields results equivalent to some serial execution. The method behaves as if implemented on top of the other public methods in this class, notably Preferences.node(String) and Preferences.put(String, String).

So, let's say you have key1, key2, and key3 on your system and you import Preferences with key2, key3, and key4.

Does your end result look like:

[key2] [key3] [key4] ?

or

[key1] [key2] [key3] [key4] ?

No comments:

Post a Comment