Writing to an already existing file using FileWriter Java

Posted by delo on Stack Overflow See other posts from Stack Overflow or by delo
Published on 2010-06-09T10:57:06Z Indexed on 2010/06/09 11:02 UTC
Read the original article Hit count: 242

Filed under:
|
|

Is there anyway I can write to an already existing file using Filewriter

For example when the user clicks a submit button:

FileWriter writer = new FileWriter("myfile.csv");
writer.append("LastName");
writer.append(',');
writer.append("FirstName");
writer.append('/n');

writer.append(LastNameTextField.getText());
writer.append(',');
writer.append(FirstNameTextField.getText());

I want to be able to write new data into the already existing myfile.csv without having to recreate a brand new one every time

© Stack Overflow or respective owner

Related posts about java

Related posts about input-output