I would like to generate line of words continously and append to a text file. As I am using WatchService, I would want to get the line appended immediately. WatchService require me to do a "Save" before it detect the modification to the file and react accordingly. Is there a way to "Save" after each line is appended?
2 Answers
Assuming that with save
you mean write to disk
, then I would suggest that you use the flush method of BufferedWriter.