Class UTF8Encoder
java.lang.Object
org.apache.jackrabbit.oak.plugins.document.util.UTF8Encoder
Utility class related to encoding characters into (UTF-8) byte sequences.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Details
-
encodeAsByteArray
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
-