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

Patrick Reinhart patrick at reini.net
Wed Nov 23 09:52:44 UTC 2016


Are there any obligations to add those constructors?

-Patrick

On 2016-11-18 10:19, Patrick Reinhart wrote:

> I was looking at the existing JDK 9 issues for some simple ones I
> could solve and found this one. I wanted to know if it makes sense to
> add additional constructors here?
> 
> Now you need to do this:
> ------------------------
> try {
>   new PrintWriter(file, "UTF-8");
> } catch (UnsupportedEncodingException e) {
>   // Ignore, this is required to be supported by the JVM.
> }
> 
> The same applies also to the String constructor...
> 
> 
> 
> Instead the following behaviour is requested:
> ---------------------------------------------
> new PrintWriter(file, StandardCharsets.UTF_8));
> 
> 
> 
> On the other hand then the next request will be to add constructors
> also to specify autoflush and so on...
> 
> -Patrick


More information about the core-libs-dev mailing list