8260265: UTF-8 by Default

Reviewed-by: alanb, rriggs
This commit is contained in:
Naoto Sato 2021-08-30 21:13:59 +00:00
parent 32048536e9
commit 7fc8540907
22 changed files with 385 additions and 201 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,8 +34,8 @@ import sun.nio.cs.StreamEncoder;
/**
* An OutputStreamWriter is a bridge from character streams to byte streams:
* Characters written to it are encoded into bytes using a specified {@link
* java.nio.charset.Charset charset}. The charset that it uses
* may be specified by name or may be given explicitly, or the platform's
* Charset charset}. The charset that it uses
* may be specified by name or may be given explicitly, or the
* default charset may be accepted.
*
* <p> Each invocation of a write() method causes the encoding converter to be
@ -48,7 +48,7 @@ import sun.nio.cs.StreamEncoder;
*
* <pre>
* Writer out
* = new BufferedWriter(new OutputStreamWriter(System.out));
* = new BufferedWriter(new OutputStreamWriter(anOutputStream));
* </pre>
*
* <p> A <i>surrogate pair</i> is a character represented by a sequence of two
@ -62,12 +62,12 @@ import sun.nio.cs.StreamEncoder;
*
* <p> This class always replaces malformed surrogate elements and unmappable
* character sequences with the charset's default <i>substitution sequence</i>.
* The {@linkplain java.nio.charset.CharsetEncoder} class should be used when more
* The {@linkplain CharsetEncoder} class should be used when more
* control over the encoding process is required.
*
* @see BufferedWriter
* @see OutputStream
* @see java.nio.charset.Charset
* @see Charset
*
* @author Mark Reinhold
* @since 1.1
@ -84,8 +84,7 @@ public class OutputStreamWriter extends Writer {
* An OutputStream
*
* @param charsetName
* The name of a supported
* {@link java.nio.charset.Charset charset}
* The name of a supported {@link Charset charset}
*
* @throws UnsupportedEncodingException
* If the named encoding is not supported
@ -103,6 +102,7 @@ public class OutputStreamWriter extends Writer {
* Creates an OutputStreamWriter that uses the default character encoding.
*
* @param out An OutputStream
* @see Charset#defaultCharset()
*/
public OutputStreamWriter(OutputStream out) {
super(out);
@ -161,7 +161,7 @@ public class OutputStreamWriter extends Writer {
* @return The historical name of this encoding, or possibly
* {@code null} if the stream has been closed
*
* @see java.nio.charset.Charset
* @see Charset
*
* @revised 1.4
*/