public final class BytesTrieBuilder extends StringTrieBuilder
This class is not intended for public subclassing.
StringTrieBuilder.Option
strings
Constructor and Description |
---|
BytesTrieBuilder()
Constructs an empty builder.
|
Modifier and Type | Method and Description |
---|---|
BytesTrieBuilder |
add(byte[] sequence,
int length,
int value)
Adds a (byte sequence, value) pair.
|
BytesTrie |
build(StringTrieBuilder.Option buildOption)
Builds a BytesTrie for the add()ed data.
|
ByteBuffer |
buildByteBuffer(StringTrieBuilder.Option buildOption)
Builds a BytesTrie for the add()ed data and byte-serializes it.
|
BytesTrieBuilder |
clear()
Removes all (byte sequence, value) pairs.
|
protected int |
getMaxBranchLinearSubNodeLength()
Deprecated.
This API is ICU internal only.
|
protected int |
getMaxLinearMatchLength()
Deprecated.
This API is ICU internal only.
|
protected int |
getMinLinearMatch()
Deprecated.
This API is ICU internal only.
|
static int |
internalEncodeDelta(int i,
byte[] intBytes)
Deprecated.
This API is ICU internal only.
|
protected boolean |
matchNodesCanHaveValues()
Deprecated.
This API is ICU internal only.
|
protected int |
write(int b)
Deprecated.
This API is ICU internal only.
|
protected int |
write(int offset,
int length)
Deprecated.
This API is ICU internal only.
|
protected int |
writeDeltaTo(int jumpTarget)
Deprecated.
This API is ICU internal only.
|
protected int |
writeValueAndFinal(int i,
boolean isFinal)
Deprecated.
This API is ICU internal only.
|
protected int |
writeValueAndType(boolean hasValue,
int value,
int node)
Deprecated.
This API is ICU internal only.
|
addImpl, buildImpl, clearImpl
public BytesTrieBuilder()
public BytesTrieBuilder add(byte[] sequence, int length, int value)
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.public BytesTrie build(StringTrieBuilder.Option buildOption)
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.
buildOption
- Build option, see StringTrieBuilder.Option.public ByteBuffer buildByteBuffer(StringTrieBuilder.Option buildOption)
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.
buildOption
- Build option, see StringTrieBuilder.Option.public BytesTrieBuilder clear()
@Deprecated protected boolean matchNodesCanHaveValues()
matchNodesCanHaveValues
in class StringTrieBuilder
@Deprecated protected int getMaxBranchLinearSubNodeLength()
getMaxBranchLinearSubNodeLength
in class StringTrieBuilder
@Deprecated protected int getMinLinearMatch()
getMinLinearMatch
in class StringTrieBuilder
@Deprecated protected int getMaxLinearMatchLength()
getMaxLinearMatchLength
in class StringTrieBuilder
@Deprecated protected int write(int b)
write
in class StringTrieBuilder
@Deprecated protected int write(int offset, int length)
write
in class StringTrieBuilder
@Deprecated protected int writeValueAndFinal(int i, boolean isFinal)
writeValueAndFinal
in class StringTrieBuilder
@Deprecated protected int writeValueAndType(boolean hasValue, int value, int node)
writeValueAndType
in class StringTrieBuilder
@Deprecated protected int writeDeltaTo(int jumpTarget)
writeDeltaTo
in class StringTrieBuilder
@Deprecated public static final int internalEncodeDelta(int i, byte[] intBytes)
Copyright © 2016 Unicode, Inc. and others.