Package io.objectbox.flatbuffers
Class Utf8.DecodeUtil
- java.lang.Object
-
- io.objectbox.flatbuffers.Utf8.DecodeUtil
-
- Enclosing class:
- Utf8
static class Utf8.DecodeUtil extends java.lang.ObjectUtility methods for decoding bytes intoString. Callers are responsible for extracting bytes (possibly using Unsafe methods), and checking remaining bytes. All other UTF-8 validity checks and codepoint conversion happen in this class.
-
-
Constructor Summary
Constructors Constructor Description DecodeUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static voidhandleFourBytes(byte byte1, byte byte2, byte byte3, byte byte4, char[] resultArr, int resultPos)(package private) static voidhandleOneByte(byte byte1, char[] resultArr, int resultPos)(package private) static voidhandleThreeBytes(byte byte1, byte byte2, byte byte3, char[] resultArr, int resultPos)(package private) static voidhandleTwoBytes(byte byte1, byte byte2, char[] resultArr, int resultPos)private static charhighSurrogate(int codePoint)private static booleanisNotTrailingByte(byte b)Returns whether the byte is not a valid continuation of the form '10XXXXXX'.(package private) static booleanisOneByte(byte b)Returns whether this is a single-byte codepoint (i.e., ASCII) with the form '0XXXXXXX'.(package private) static booleanisThreeBytes(byte b)Returns whether this is a three-byte codepoint with the form '110XXXXX'.(package private) static booleanisTwoBytes(byte b)Returns whether this is a two-byte codepoint with the form '10XXXXXX'.private static charlowSurrogate(int codePoint)private static inttrailingByteValue(byte b)Returns the actual value of the trailing byte (removes the prefix '10') for composition.
-
-
-
Method Detail
-
isOneByte
static boolean isOneByte(byte b)
Returns whether this is a single-byte codepoint (i.e., ASCII) with the form '0XXXXXXX'.
-
isTwoBytes
static boolean isTwoBytes(byte b)
Returns whether this is a two-byte codepoint with the form '10XXXXXX'.
-
isThreeBytes
static boolean isThreeBytes(byte b)
Returns whether this is a three-byte codepoint with the form '110XXXXX'.
-
handleOneByte
static void handleOneByte(byte byte1, char[] resultArr, int resultPos)
-
handleTwoBytes
static void handleTwoBytes(byte byte1, byte byte2, char[] resultArr, int resultPos) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
handleThreeBytes
static void handleThreeBytes(byte byte1, byte byte2, byte byte3, char[] resultArr, int resultPos) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
handleFourBytes
static void handleFourBytes(byte byte1, byte byte2, byte byte3, byte byte4, char[] resultArr, int resultPos) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
isNotTrailingByte
private static boolean isNotTrailingByte(byte b)
Returns whether the byte is not a valid continuation of the form '10XXXXXX'.
-
trailingByteValue
private static int trailingByteValue(byte b)
Returns the actual value of the trailing byte (removes the prefix '10') for composition.
-
highSurrogate
private static char highSurrogate(int codePoint)
-
lowSurrogate
private static char lowSurrogate(int codePoint)
-
-