Class BytesTrieBuilder
This class is not intended for public subclassing.
- Author:
- Markus W. Scherer
- Status:
- Stable ICU 4.8.
-
Nested Class Summary
Nested classes/interfaces inherited from class StringTrieBuilder
StringTrieBuilder.OptionModifier and TypeClassDescriptionstatic enumBuild options for BytesTrieBuilder and CharsTrieBuilder. -
Field Summary
Fields inherited from class StringTrieBuilder
stringsModifier and TypeFieldDescriptionprotected StringBuilderDeprecated.This API is ICU internal only. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(byte[] sequence, int length, int value) Adds a (byte sequence, value) pair.build(StringTrieBuilder.Option buildOption) Builds a BytesTrie for the add()ed data.buildByteBuffer(StringTrieBuilder.Option buildOption) Builds a BytesTrie for the add()ed data and byte-serializes it.clear()Removes all (byte sequence, value) pairs.protected intDeprecated.This API is ICU internal only.protected intDeprecated.This API is ICU internal only.protected intDeprecated.This API is ICU internal only.static final intinternalEncodeDelta(int i, byte[] intBytes) Deprecated.This API is ICU internal only.protected booleanDeprecated.This API is ICU internal only.protected intwrite(int b) Deprecated.This API is ICU internal only.protected intwrite(int offset, int length) Deprecated.This API is ICU internal only.protected intwriteDeltaTo(int jumpTarget) Deprecated.This API is ICU internal only.protected intwriteValueAndFinal(int i, boolean isFinal) Deprecated.This API is ICU internal only.protected intwriteValueAndType(boolean hasValue, int value, int node) Deprecated.This API is ICU internal only.Methods inherited from class StringTrieBuilder
addImpl, buildImpl, clearImplModifier and TypeMethodDescriptionprotected voidaddImpl(CharSequence s, int value) Deprecated.This API is ICU internal only.protected final voidbuildImpl(StringTrieBuilder.Option buildOption) Deprecated.This API is ICU internal only.protected voidDeprecated.This API is ICU internal only.
-
Constructor Details
-
BytesTrieBuilder
public BytesTrieBuilder()Constructs an empty builder.- Status:
- Stable ICU 4.8.
-
-
Method Details
-
add
Adds a (byte sequence, value) pair. The byte sequence must be unique. Bytes 0..length-1 will be copied; the builder does not keep a reference to the input array.- Parameters:
sequence- The array that contains the byte sequence, starting at index 0.length- The length of the byte sequence.value- The value associated with this byte sequence.- Returns:
- this
- Status:
- Stable ICU 4.8.
-
build
Builds a BytesTrie for the add()ed data. Once built, no further data can be add()ed until clear() is called.A BytesTrie cannot be empty. At least one (byte sequence, value) pair must have been add()ed.
Multiple calls to build() or buildByteBuffer() return tries or buffers which share the builder's byte array, without rebuilding. The byte array must not be modified via the buildByteBuffer() result object. After clear() has been called, a new array will be used.
- Parameters:
buildOption- Build option, see StringTrieBuilder.Option.- Returns:
- A new BytesTrie for the add()ed data.
- Status:
- Stable ICU 4.8.
-
buildByteBuffer
Builds a BytesTrie for the add()ed data and byte-serializes it. Once built, no further data can be add()ed until clear() is called.A BytesTrie cannot be empty. At least one (byte sequence, value) pair must have been add()ed.
Multiple calls to build() or buildByteBuffer() return tries or buffers which share the builder's byte array, without rebuilding. Do not modify the bytes in the buffer! After clear() has been called, a new array will be used.
The serialized BytesTrie is accessible via the buffer's array()/arrayOffset()+position() or remaining()/get(byte[]) etc.
- Parameters:
buildOption- Build option, see StringTrieBuilder.Option.- Returns:
- A ByteBuffer with the byte-serialized BytesTrie for the add()ed data. The buffer is not read-only and array() can be called.
- Status:
- Stable ICU 4.8.
-
clear
Removes all (byte sequence, value) pairs. New data can then be add()ed and a new trie can be built.- Returns:
- this
- Status:
- Stable ICU 4.8.
-
matchNodesCanHaveValues
Deprecated.This API is ICU internal only.- Specified by:
matchNodesCanHaveValuesin classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
getMaxBranchLinearSubNodeLength
Deprecated.This API is ICU internal only.- Specified by:
getMaxBranchLinearSubNodeLengthin classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
getMinLinearMatch
Deprecated.This API is ICU internal only.- Specified by:
getMinLinearMatchin classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
getMaxLinearMatchLength
Deprecated.This API is ICU internal only.- Specified by:
getMaxLinearMatchLengthin classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
write
Deprecated.This API is ICU internal only.- Specified by:
writein classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
write
Deprecated.This API is ICU internal only.- Specified by:
writein classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
writeValueAndFinal
Deprecated.This API is ICU internal only.- Specified by:
writeValueAndFinalin classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
writeValueAndType
Deprecated.This API is ICU internal only.- Specified by:
writeValueAndTypein classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
writeDeltaTo
Deprecated.This API is ICU internal only.- Specified by:
writeDeltaToin classStringTrieBuilder- Status:
- Internal. This API is ICU internal only.
-
internalEncodeDelta
Deprecated.This API is ICU internal only.- Status:
- Internal. This API is ICU internal only.
-