-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b59
-
generic
-
generic
The new Print{Stream,Writer} convenience constructors added for formatting
are inconsistent with respect to flushing. All state that there is no
automatic line flushing; however, this likely not what's actually implemented.
From ###@###.###:
Stream flushing is a little odd. PrintWriter only flushes when a newline is
written, so
PrintWriter.printf("Hello");
should *not* autoflush, while one can argue that
PrintStream.printf("Hello");
*should* autoflush because
PrintStream.print("Hello");
does.
The flushing behavior in these classes is weird and inconsistent, but we
need to try to not introduce any more.
PrintWriter class doc goes out of its way to point out how its flushing
behavior is different from PrintStream's.
In an ideal world, we would want, for any output stream s,
changing
s.print("foo")
to
s.printf("foo")
and
s.println("foo")
to
s.printf("foo%n")
should have no observable effect, including with regard to stream flushing.
are inconsistent with respect to flushing. All state that there is no
automatic line flushing; however, this likely not what's actually implemented.
From ###@###.###:
Stream flushing is a little odd. PrintWriter only flushes when a newline is
written, so
PrintWriter.printf("Hello");
should *not* autoflush, while one can argue that
PrintStream.printf("Hello");
*should* autoflush because
PrintStream.print("Hello");
does.
The flushing behavior in these classes is weird and inconsistent, but we
need to try to not introduce any more.
PrintWriter class doc goes out of its way to point out how its flushing
behavior is different from PrintStream's.
In an ideal world, we would want, for any output stream s,
changing
s.print("foo")
to
s.printf("foo")
and
s.println("foo")
to
s.printf("foo%n")
should have no observable effect, including with regard to stream flushing.