So if we do like this:
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, "");
other keys in existing properties will be deleted, how to avoid that?
delete keyword is used to delete properties of an object in javaScript.
One way is to add a property using the dot notation: obj. foo = 1; We added the foo property to the obj object above with value 1.
There are two ways to remove a property from a JavaScript object. There's the mutable way of doing it using the delete operator, and the immutable way of doing it using object restructuring.
Load properties from that file before modifying it. In other words, replace
Properties props = new Properties();
with
Properties props = Properties.load(new FileInputStream(Store.class.getResource("my.properties").getFile()));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With