I think the best way is to
- Define default buffering for
stdout
andstderr
. On Linux,stdout
is line-buffered andstderr
is unbuffered (I haven’t verified this, though). I think these are excellent defaults. - Give the programmer the ability of setting the buffering behavior of a new stream.
- Give the programmer the ability of changing the buffering mode of any stream.
I’m afraid I don’t think that flushing in println()
is the way to go. We expect maximal efficiency when printing into a fully buffered stream, but your redefinition of println
would degrade the performance.