chris yo
chris yo

Reputation: 1277

Append to a file in JavaIoFileSystemAccess

How do I append text to a file in JavaIoFileSystemAccess?

I have tried calling the generateFile with the same filename, but it just overwrites the content of the file.

Is there a setting or method I can call to be able to append contents to a file?

Upvotes: 1

Views: 84

Answers (1)

Prabhaker A
Prabhaker A

Reputation: 8473

You can use FileWriter class overloaded constructor for this.

FileWriter fileWriter = new FileWriter(new File("filepath in string"),true);  

//second parameter specifies whether write this file
                                              in append mode or normal mode  
//true for append mode

Upvotes: 3

Related Questions