append properties file from java -


from java want read .properties file , if property present want re-set property again. lets .properties file has entry password=123 want check if password entry there replace 123 567. need keep content is. how that? please help

one solution can think of rightaway is

  1. load properties base .properties file.
  2. create new temp properties file , loop through entries original file write same in new file. in loop can change value of property while writing new file.
  3. after loop delete original file , rename temp file original file.

this approach has couple of limitations,

  1. do not use if concerned file last modified/created date, since creating whole new file here.
  2. if original file big, approach may cause memory problems.

hope helps!


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -