Reputation: 2180
I read that the difference between FileWriter and BufferedWriter is that FileWriter writes directly into a file(char by char), white BufferedReader uses a buffer. If so, why does FileWriter have a buffer? For example if I make a FileWriter object like this:
FileWriter writer = new FileWriter("f://test123.txt");
and, if I don't flush or close the writer in the end of the program, it would not write anything to a file. That means it alos uses a buffer. Please, explain?
Upvotes: 0
Views: 145
Reputation: 311023
It doesn't have a buffer itself but it extends OutputStreamWriter
, which does, in the form of a StreamEncoder.
Upvotes: 0