I would like to know if FileWriter is buffered.
In this SO question, it looks like it is, however, in this SO question, it seems that (this will be a system call for every write (..) call.
So basically, after reading these two Q&A, I'm a little confused. Can anyone clearly explain this?
Thanks in advance.
EDIT : The problem is solved by reading this API, which I quote from the relevant part:
Each call to the write () method causes the encoding converter to be called on the specified character (s). The resulting bytes are accumulated in the buffer before being written to the original output stream. The size of this buffer can be specified, but by default it is large enough for most purposes. Note that characters passed to write () are not buffered.
For maximum efficiency, consider porting OutputStreamWriter within a BufferedWriter to avoid frequent conversions. For example:
Writer out = new BufferedWriter (new OutputStreamWriter (System.out));
Since FileWriter extends OutputStreamWriter, it also applies to it.
Thank you for your time, but I know that I asked for something very specific.
source share