A DESCRIPTION OF THE REQUEST :
There is no constructor of java.util.Scanner that takes a java.nio.charset.Charset
intead of a String to specify a charset for byte stream.
I propose to add 3 constructors:
- Scanner(File source, Charset charset)
- Scanner(InputStream source, Charset charset)
- Scanner(ReadableByteChannel source, Charset charset)
JUSTIFICATION :
charset specified as a String has 3 problems :
- it's error prone to use a String because it's easy to malform it
- sometimes you have a Charset in that case, you have to
transform it to a String and the Scanner implementation
will retransform it to a Charset.
- the implementation use a thread local cache which is
not necessary if you know the Charset
CUSTOMER SUBMITTED WORKAROUND :
Use String based constructors.
            
There is no constructor of java.util.Scanner that takes a java.nio.charset.Charset
intead of a String to specify a charset for byte stream.
I propose to add 3 constructors:
- Scanner(File source, Charset charset)
- Scanner(InputStream source, Charset charset)
- Scanner(ReadableByteChannel source, Charset charset)
JUSTIFICATION :
charset specified as a String has 3 problems :
- it's error prone to use a String because it's easy to malform it
- sometimes you have a Charset in that case, you have to
transform it to a String and the Scanner implementation
will retransform it to a Charset.
- the implementation use a thread local cache which is
not necessary if you know the Charset
CUSTOMER SUBMITTED WORKAROUND :
Use String based constructors.
- duplicates
- 
                    JDK-8134807 (scanner) Scanner should have constructor overloads that take Charset -           
- Closed
 
-         
 P5
  P5