Import a file of exported preference data in Java
Description
The following code shows how to import a file of exported preference data.
Example
//www . j a v a 2 s . com
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.prefs.Preferences;
public class Main {
public static void main(String[] argv) throws Exception {
// Create an input stream on a file
InputStream is = new BufferedInputStream(new FileInputStream("output.xml"));
// Import preference data
Preferences.importPreferences(is);
}
}
The code above generates the following result.