public class UTF8Encoder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canEncode(java.lang.CharSequence input)
See
CharsetEncoder.canEncode(CharSequence) . |
static byte[] |
encodeAsByteArray(java.lang.String input)
Like
String.getBytes(java.nio.charset.Charset) (with "UTF-8"),
except that invalid character sequences (such as unpaired surrogates) are
reported as exceptions (see CodingErrorAction.REPORT , instead of
being silently replaced by a replacement character as it would happen
otherwise. |
public static byte[] encodeAsByteArray(java.lang.String input) throws java.io.IOException
String.getBytes(java.nio.charset.Charset)
(with "UTF-8"),
except that invalid character sequences (such as unpaired surrogates) are
reported as exceptions (see CodingErrorAction.REPORT
, instead of
being silently replaced by a replacement character as it would happen
otherwise.input
- String to encodeStandardCharsets.UTF_8
java.io.IOException
- on encoding errorpublic static boolean canEncode(java.lang.CharSequence input)
CharsetEncoder.canEncode(CharSequence)
.Copyright © 2012–2022 The Apache Software Foundation. All rights reserved.