e418. importing preferences.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 21 行
TXT
21 行
Preferences can be exported using Preferences.exportNode() (see e419 Exporting the Preferences in a Preference Node) and Preferences.exportSubtree() (see e420 Exporting the Preferences in a Subtree of Preference Nodes). This exported data can be imported using Preferences.importPreferences().
Each preference in exported data contains the path of the node that held the preference. When the exported preference is later imported, it is added to the node with the same path.
This example demonstrates how to import a file of exported preference data.
// Create an input stream on a file
InputStream is = null;
try {
is = new BufferedInputStream(new FileInputStream("output.xml"));
} catch (FileNotFoundException e) {
}
// Import preference data
try {
Preferences.importPreferences(is);
} catch (InvalidPreferencesFormatException e) {
} catch (IOException e) {
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?