Top Fields Constructors Methods
com.ibm.icu.impl

public Class Trie2_32

extends Trie2
Class Inheritance
Imports
java.io.DataOutputStream, .IOException, .OutputStream, java.nio.ByteBuffer

Author
aheninger A read-only Trie2, holding 32 bit data values. A Trie2 is a highly optimized data structure for mapping from Unicode code points (values ranging from 0 to 0x10ffff) to a 16 or 32 bit value. See class Trie2 for descriptions of the API for accessing the contents of a trie. The fundamental data access methods are declared final in this class, with the intent that applications might gain a little extra performance, when compared with calling the same methods via the abstract UTrie2 base class.

Field Summary

Inherited from com.ibm.icu.impl.Trie2:
data16data32dataLengthdataNullOffseterrorValuefHashheaderhighStarthighValueIndexindexindex2NullOffsetindexLengthinitialValueUNEWTRIE2_INDEX_1_LENGTHUNEWTRIE2_INDEX_GAP_LENGTHUNEWTRIE2_INDEX_GAP_OFFSETUNEWTRIE2_MAX_DATA_LENGTHUNEWTRIE2_MAX_INDEX_2_LENGTHUTRIE2_BAD_UTF8_DATA_OFFSETUTRIE2_CP_PER_INDEX_1_ENTRYUTRIE2_DATA_BLOCK_LENGTHUTRIE2_DATA_GRANULARITYUTRIE2_DATA_MASKUTRIE2_DATA_START_OFFSETUTRIE2_INDEX_1_OFFSETUTRIE2_INDEX_2_BLOCK_LENGTHUTRIE2_INDEX_2_BMP_LENGTHUTRIE2_INDEX_2_MASKUTRIE2_INDEX_2_OFFSETUTRIE2_INDEX_SHIFTUTRIE2_LSCP_INDEX_2_LENGTHUTRIE2_LSCP_INDEX_2_OFFSETUTRIE2_MAX_INDEX_1_LENGTHUTRIE2_OMITTED_BMP_INDEX_1_LENGTHUTRIE2_OPTIONS_VALUE_BITS_MASKUTRIE2_SHIFT_1UTRIE2_SHIFT_1_2UTRIE2_SHIFT_2UTRIE2_UTF8_2B_INDEX_2_LENGTHUTRIE2_UTF8_2B_INDEX_2_OFFSET

Constructor Summary

AccessConstructor and Description
pack-priv
Trie2_32()

Internal constructor, not for general use.

Method Summary

Modifier and TypeMethod and Description
public static Trie2_32

Returns:

An unserialized Trie_32, ready for use.
createFromSerialized
(ByteBuffer
a byte buffer to the serialized form of a UTrie2.
bytes
)

Hides com.ibm.icu.impl.Trie2.createFromSerialized.

Create a Trie2 from its serialized form.
public final int

Returns:

the value
get
(int
the code point
codePoint
)

Implements abstract com.ibm.icu.impl.Trie2.get.

Get the value for a code point as stored in the Trie2.
public int

Returns:

the value
getFromU16SingleLead
(char
a 16 bit code unit or lead surrogate value.
codeUnit
)

Implements abstract com.ibm.icu.impl.Trie2.getFromU16SingleLead.

Get a Trie2 value for a UTF-16 code unit.
public int

Returns:

the number of bytes of the serialized trie
getSerializedLength
()

pack-priv int

Returns:

The last code point with the same value as the starting code point.
rangeEnd
(int
The code point at which to begin looking.
startingCP
,
int limit, int value)

Overrides com.ibm.icu.impl.Trie2.rangeEnd.

Given a starting code point, find the last in a range of code points, all with the same value.
public int

Returns:

the number of bytes written.
serialize
(OutputStream
the stream to which the serialized Trie2 data will be written.
os
)

Serialize a Trie2_32 onto an OutputStream.

Inherited from com.ibm.icu.impl.Trie2:
charSequenceIteratorequalsgetVersionhashCodeiteratoriteratoriteratorForLeadSurrogateiteratorForLeadSurrogateserializeHeader

Constructor Detail

Trie2_32back to summary
pack-priv Trie2_32()

Internal constructor, not for general use.

Method Detail

createFromSerializedback to summary
public static Trie2_32 createFromSerialized(ByteBuffer bytes) throws IOException

Hides com.ibm.icu.impl.Trie2.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:ByteBuffer

a byte buffer to the serialized form of a UTrie2.

Returns:Trie2_32

An unserialized Trie_32, ready for use.

Exceptions
IOException:
if a read error occurs in the buffer.
IllegalArgumentException:
if the stream does not contain a serialized Trie2.
ClassCastException:
if the bytes contains a serialized Trie2_16
getback to summary
public final int get(int codePoint)

Implements abstract com.ibm.icu.impl.Trie2.get.

Get the value for a code point as stored in the Trie2.

Parameters
codePoint:int

the code point

Returns:int

the value

Annotations
@Override
getFromU16SingleLeadback to summary
public int getFromU16SingleLead(char codeUnit)

Implements abstract com.ibm.icu.impl.Trie2.getFromU16SingleLead.

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.

Parameters
codeUnit:char

a 16 bit code unit or lead surrogate value.

Returns:int

the value

Annotations
@Override
getSerializedLengthback to summary
public int getSerializedLength()
Returns:int

the number of bytes of the serialized trie

rangeEndback to summary
pack-priv int rangeEnd(int startingCP, int limit, int value)

Overrides com.ibm.icu.impl.Trie2.rangeEnd.

Given a starting code point, find the last in a range of code points, all with the same value. This function is part of the implementation of iterating over the Trie2's contents.

Parameters
startingCP:int

The code point at which to begin looking.

Returns:int

The last code point with the same value as the starting code point.

Annotations
@Override
serializeback to summary
public int serialize(OutputStream os) throws IOException

Serialize a Trie2_32 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:OutputStream

the stream to which the serialized Trie2 data will be written.

Returns:int

the number of bytes written.

Exceptions
IOException:
on an error writing to the OutputStream.