I have a Java program that reads some text from a file, line by line, and writes new text to an output file. But not all the text I write to my BufferedWriter a
BufferedWriter
Always close your resources (not just files) when you're done with them.
finally { out.close();//this would resolve the issue }
There might be situations when you want to flush the buffer without closing the file. In these situations you can use the flush-method.