Reputation: 1277
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
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