Class Trie2_16
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.Trie2
org.graalvm.shadowed.com.ibm.icu.impl.Trie2_16
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graalvm.shadowed.com.ibm.icu.impl.Trie2
Trie2.CharSequenceIterator, Trie2.CharSequenceValues, Trie2.Range, Trie2.ValueMapper -
Method Summary
Modifier and TypeMethodDescriptionstatic Trie2_16createFromSerialized(ByteBuffer bytes) Create a Trie2 from its serialized form.final intget(int codePoint) Get the value for a code point as stored in the Trie2.intgetFromU16SingleLead(char codeUnit) Get a Trie2 value for a UTF-16 code unit.intintSerialize a Trie2_16 onto an OutputStream.Methods inherited from class org.graalvm.shadowed.com.ibm.icu.impl.Trie2
charSequenceIterator, equals, getVersion, hashCode, iterator, iterator, iteratorForLeadSurrogate, iteratorForLeadSurrogate, serializeHeaderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
createFromSerialized
Create a Trie2 from its serialized form. Inverse of utrie2_serialize(). The serialized format is identical between ICU4C and ICU4J, so this function will work with serialized Trie2s from either. The serialized Trie2 in the bytes may be in either little or big endian byte order. This allows using serialized Tries from ICU4C without needing to consider the byte order of the system that created them.- Parameters:
bytes- a byte buffer to the serialized form of a UTrie2.- Returns:
- An unserialized Trie2_16, ready for use.
- Throws:
IllegalArgumentException- if the buffer does not contain a serialized Trie2.IOException- if a read error occurs in the buffer.ClassCastException- if the bytes contain a serialized Trie2_32
-
get
-
getFromU16SingleLead
public int getFromU16SingleLead(char codeUnit) Get a Trie2 value for a UTF-16 code unit. This function returns the same value as get() if the input character is outside of the lead surrogate range There are two values stored in a Trie2 for inputs in the lead surrogate range. This function returns the alternate value, while Trie2.get() returns the main value.- Specified by:
getFromU16SingleLeadin classTrie2- Parameters:
codeUnit- a 16 bit code unit or lead surrogate value.- Returns:
- the value
-
serialize
Serialize a Trie2_16 onto an OutputStream. A Trie2 can be serialized multiple times. The serialized data is compatible with ICU4C UTrie2 serialization. Trie2 serialization is unrelated to Java object serialization.- Parameters:
os- the stream to which the serialized Trie2 data will be written.- Returns:
- the number of bytes written.
- Throws:
IOException
-
getSerializedLength
public int getSerializedLength()- Returns:
- the number of bytes of the serialized trie
-