Why do certain streams need to be flushed (FileOutputStream
and streams from Sockets) while the standard output stream does not?
Every time someone uses the System.out
PrintStream
object, be it while calling println()
or write()
, they never flush the stream. However, other programmers habitually call flush()
a PrintStream
/PrintWriter
with other streams.
I've recently asked this question to several programmers and some believe that there is some background handling in Java to auto-flush the System.out
stream but I can't find any documentation on that.
Something like this makes me wonder if simply calling System.out.println()
is platform independent as some systems may need you to flush the stream.
if true
, but is it? I could not find any documentation about the value of autoFlush for System.out... – Hanover