mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8260265: UTF-8 by Default
Reviewed-by: alanb, rriggs
This commit is contained in:
parent
32048536e9
commit
7fc8540907
22 changed files with 385 additions and 201 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
|
@ -198,16 +198,17 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
|
||||
/**
|
||||
* Converts the buffer's contents into a string decoding bytes using the
|
||||
* platform's default character set. The length of the new {@code String}
|
||||
* is a function of the character set, and hence may not be equal to the
|
||||
* default charset. The length of the new {@code String}
|
||||
* is a function of the charset, and hence may not be equal to the
|
||||
* size of the buffer.
|
||||
*
|
||||
* <p> This method always replaces malformed-input and unmappable-character
|
||||
* sequences with the default replacement string for the platform's
|
||||
* default character set. The {@linkplain java.nio.charset.CharsetDecoder}
|
||||
* sequences with the default replacement string for the
|
||||
* default charset. The {@linkplain java.nio.charset.CharsetDecoder}
|
||||
* class should be used when more control over the decoding process is
|
||||
* required.
|
||||
*
|
||||
* @see Charset#defaultCharset()
|
||||
* @return String decoded from the buffer's contents.
|
||||
* @since 1.1
|
||||
*/
|
||||
|
@ -217,10 +218,10 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
|
||||
/**
|
||||
* Converts the buffer's contents into a string by decoding the bytes using
|
||||
* the named {@link java.nio.charset.Charset charset}.
|
||||
* the named {@link Charset charset}.
|
||||
*
|
||||
* <p> This method is equivalent to {@code #toString(charset)} that takes a
|
||||
* {@link java.nio.charset.Charset charset}.
|
||||
* {@link Charset charset}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
*
|
||||
|
@ -240,7 +241,7 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
*
|
||||
*
|
||||
* @param charsetName the name of a supported
|
||||
* {@link java.nio.charset.Charset charset}
|
||||
* {@link Charset charset}
|
||||
* @return String decoded from the buffer's contents.
|
||||
* @throws UnsupportedEncodingException
|
||||
* If the named charset is not supported
|
||||
|
@ -254,7 +255,7 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
|
||||
/**
|
||||
* Converts the buffer's contents into a string by decoding the bytes using
|
||||
* the specified {@link java.nio.charset.Charset charset}. The length of the new
|
||||
* the specified {@link Charset charset}. The length of the new
|
||||
* {@code String} is a function of the charset, and hence may not be equal
|
||||
* to the length of the byte array.
|
||||
*
|
||||
|
@ -263,7 +264,7 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
* java.nio.charset.CharsetDecoder} class should be used when more control
|
||||
* over the decoding process is required.
|
||||
*
|
||||
* @param charset the {@linkplain java.nio.charset.Charset charset}
|
||||
* @param charset the {@linkplain Charset charset}
|
||||
* to be used to decode the {@code bytes}
|
||||
* @return String decoded from the buffer's contents.
|
||||
* @since 10
|
||||
|
@ -286,14 +287,14 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
* As of JDK 1.1, the preferred way to do this is via the
|
||||
* {@link #toString(String charsetName)} or {@link #toString(Charset charset)}
|
||||
* method, which takes an encoding-name or charset argument,
|
||||
* or the {@code toString()} method, which uses the platform's default
|
||||
* character encoding.
|
||||
* or the {@code toString()} method, which uses the default charset.
|
||||
*
|
||||
* @param hibyte the high byte of each resulting Unicode character.
|
||||
* @return the current contents of the output stream, as a string.
|
||||
* @see java.io.ByteArrayOutputStream#size()
|
||||
* @see java.io.ByteArrayOutputStream#toString(String)
|
||||
* @see java.io.ByteArrayOutputStream#toString()
|
||||
* @see Charset#defaultCharset()
|
||||
*/
|
||||
@Deprecated
|
||||
public synchronized String toString(int hibyte) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue