ByteArrayOutputStream.toString

Converts the buffer's contents into a string decoding bytes using the platform's default character set. The length of the new <tt>string</tt> is a function of the character set, 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} class should be used when more control over the decoding process is required.

@return string decoded from the buffer's contents.

  1. string toString()
    class ByteArrayOutputStream
    override
    string
    toString
    ()
  2. string toString(string charsetName)

Meta