Link to home
Start Free TrialLog in
Avatar of Manikandan Thiagarajan
Manikandan ThiagarajanFlag for India

asked on

i want to append the properties file line by line could you give me a code for that

i want to append the properties file line by line could you give me a code for that
Avatar of Mick Barry
Mick Barry
Flag of Australia image

FileOutputStream out = new FileOutputStream("myfile.txt", true);   // open in append mode
PrintWriter printer = new PrintWriter(new OutputStreamWriter(out));
printer.println("line1=abc");
printer.println("line2=def");
out.close();
You probably want to load properties from the file
add new property and store the them to file again
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could of course append your properties line by laine and save the
property file ater you set each property
This is of course equivalent to appending the file directly, but
takes a little bit less code.