Class UTF8Encoder
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.util.UTF8Encoder
-
public class UTF8Encoder extends Object
Utility class related to encoding characters into (UTF-8) byte sequences.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canEncode(CharSequence input)
static byte[]
encodeAsByteArray(String input)
LikeString.getBytes(java.nio.charset.Charset)
(with "UTF-8"), except that invalid character sequences (such as unpaired surrogates) are reported as exceptions (seeCodingErrorAction.REPORT
, instead of being silently replaced by a replacement character as it would happen otherwise.
-
-
-
Method Detail
-
encodeAsByteArray
public static byte[] encodeAsByteArray(String input) throws IOException
LikeString.getBytes(java.nio.charset.Charset)
(with "UTF-8"), except that invalid character sequences (such as unpaired surrogates) are reported as exceptions (seeCodingErrorAction.REPORT
, instead of being silently replaced by a replacement character as it would happen otherwise.- Parameters:
input
- String to encode- Returns:
- String encoded using
StandardCharsets.UTF_8
- Throws:
IOException
- on encoding error
-
canEncode
public static boolean canEncode(CharSequence input)
-
-