Summary
Add overloading Constructors/Methods that take a Charset object as a parameter to APIs in java.io, java.net, java.nio and java.util. These APIs contain existing Constructors/Methods that take a Charset or Encoding name as a parameter.
Problem
There are a variety of APIs in the java.base module that take a charset or encoding name as a parameter and are declared to throw UnsupportedEncodingException, which is checked. Having to enter a literal charset or encoding name is inconvenient and error prone, while the check Exception is unnecessary in most cases.
Solution
Add overloading Constructors/Methods that take a Charset object as a parameter.
Specification
Add overloading Constructors/Methods to the following classes:
java.io
java/io/ByteArrayOutputStream.java
java/io/PrintStream.java
java/io/PrintWriter.java
java.net
java/net/URLDecoder.java
java/net/URLEncoder.java
java.nio
java/nio/channels/Channels.java
java.util
java/util/Formatter.java
java/util/Properties.java
java/util/Scanner.java
specdiffs attached. Below is a convenient link:
http://cr.openjdk.java.net/~joehw/jdk10/8190577/specdiff/overview-summary.html
- csr of
-
JDK-8183743 Umbrella: add overloads that take a Charset parameter
-
- Resolved
-
- duplicates
-
JDK-8192381 URLEncoder StandardCharset support
-
- Closed
-