public class UTF8Encoder extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canEncode(CharSequence input)
|
static byte[] |
encodeAsByteArray(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(String input) throws 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_8IOException - on encoding errorpublic static boolean canEncode(CharSequence input)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.