RFR: JDK-8167648: java.io.PrintWriter should have PrintWriter((String|File), Charset) constructors

Patrick Reinhart patrick at reini.net
Wed Nov 23 12:23:50 UTC 2016


Hi Stephen,

On 2016-11-23 12:04, Stephen Colebourne wrote:


> Perhaps a method withAutoFlush(boolean) could reduce the number of

To make that work, we would have to make the boolean field "autoFlush" 
writeable. Also the auto flush behaviour could be changed at any time. I 
would then prefer to only have something like a one-way-street as this:

withAutoFlush() intentionally no argument to only change it to enabled.


> constructors? And perhaps the String filename is an anachronism?
> 
> Thus, adding these three methods might be enough:
> 
> PrintWriter(OutputStream, Charset)
> PrintWriter(File, Charset)
> withAutoFlush(boolean)
> 
> Stephen
> 


I would think, this would be a good change.

-Patrick


More information about the core-libs-dev mailing list