Converts the buffer's contents into a string by decoding the bytes using
the named charset.
This method is equivalent to #toString(charset) that takes a
charset.
An invocation of this method of the form
ByteArrayOutputStream b = ...
b.toString("UTF-8")
behaves in exactly the same way as the expression
ByteArrayOutputStream b = ...
b.toString(StandardCharsets.UTF_8)
charsetName | the name of a supported
charset |
UnsupportedEncodingException
| If the named charset is not supported |
Diagram: OutputStream