ByteArrayOutputStream.toString

Converts the buffer's contents into a string by decoding the bytes using the named {@link java.nio.charset.Charset charset}. The length of the new <tt>string</tt> is a function of the charset, and hence may not be equal to the length of the byte array.

<p> This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement string. The {@link java.nio.charset.CharsetDecoder} class should be used when more control over the decoding process is required.

@param charsetName the name of a supported {@link java.nio.charset.Charset charset} @return string decoded from the buffer's contents. @exception UnsupportedEncodingException If the named charset is not supported

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

Meta