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
According to documentation it is no use calling flush()
method. If you intent to use FileWriter
then flush()
would help you out.
Basically in this case, you just need to close, BufferedWriter.close()
only. This will flush the remainder of your data.
create finally block and put the close method inside so that it will put all data without missing.
finally {
out.close();
}