所以,如果我们这样做:
Properties props = new Properties();
OutputStream osr = new FileOutputStream(Store.class.getResource("my.properties").getFile());
props.setProperty("wallboard_text_rgb", "aaa");
props.setProperty("wallboard_back_rgb", "bbb");
props.store(osr, "");
Run Code Online (Sandbox Code Playgroud)
现有属性中的其他键将被删除,如何避免?
在修改该文件之前从该文件加载属性。换句话说,替换
Properties props = new Properties();
Run Code Online (Sandbox Code Playgroud)
和
Properties props = Properties.load(new FileInputStream(Store.class.getResource("my.properties").getFile()));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1547 次 |
| 最近记录: |