The second sentence of the FileWriter
class overview says:
The constructors of this class assume that the default character encoding and the default byte-buffer size are acceptable. To specify these values yourself, construct an OutputStreamWriter on a FileOutputStream.
(My emphasis)
So clearly it's buffered (unless the default byte-buffer size is zero and they're being really odd with their phrasing).
I suspect it's just using an OutputStreamWriter
on a FileOutputStream
. Looking at OutputStreamWriter
:
Each invocation of a write() method causes the encoding converter to be invoked on the given character(s). The resulting bytes are accumulated in a buffer before being written to the underlying output stream.
(My emphasis)
If you want to ensure that various buffers at various levels are flushed, to the extent you can, look at using the flush
method.