public byte[] getBytes (Charset charset)

Encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array.

This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement byte array. The java.nio.charset.CharsetEncoder class should be used when more control over the encoding process is required.

Parameters:
charset     The java.nio.charset.Charset to be used to encode the String

Returns:  The resultant byte array

Since:  1.6