public class CharsetEncodingUtils extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
encodeAsUTF8(String input)
Like
String.getBytes(java.nio.charset.Charset) (with "UTF-8"),
except that encoding problems (like unpaired surrogates) are reported as
exceptions (see CodingErrorAction.REPORT , instead of being
silently replaces as it would happen otherwise. |
public static byte[] encodeAsUTF8(String input) throws IOException
String.getBytes(java.nio.charset.Charset)
(with "UTF-8"),
except that encoding problems (like unpaired surrogates) are reported as
exceptions (see CodingErrorAction.REPORT
, instead of being
silently replaces as it would happen otherwise.input
- String to encodeStandardCharsets.UTF_8
IOException
- on encoding errorCopyright © 2012–2020 The Apache Software Foundation. All rights reserved.