final class FixedLengthBytesRefArray extends java.lang.Object implements SortableBytesRefArray
BytesRefArray
except all values have the same length.
Note: This class is not Thread-Safe!Modifier and Type | Field and Description |
---|---|
private byte[][] |
blocks |
private int |
currentBlock
How many blocks are used
|
private int |
nextEntry |
private int |
size
How many values have been appended
|
private int |
valueLength |
private int |
valuesPerBlock |
Constructor and Description |
---|
FixedLengthBytesRefArray(int valueLength)
Creates a new
BytesRefArray with a counter to track allocated bytes |
Modifier and Type | Method and Description |
---|---|
int |
append(BytesRef bytes)
Appends a copy of the given
BytesRef to this BytesRefArray . |
void |
clear()
Clears this
BytesRefArray |
BytesRefIterator |
iterator(java.util.Comparator<BytesRef> comp)
Returns a
BytesRefIterator with point in time semantics. |
int |
size()
Returns the current size of this
FixedLengthBytesRefArray |
private int[] |
sort(java.util.Comparator<BytesRef> comp) |
private final int valueLength
private final int valuesPerBlock
private int size
private int currentBlock
private int nextEntry
private byte[][] blocks
public FixedLengthBytesRefArray(int valueLength)
BytesRefArray
with a counter to track allocated bytespublic void clear()
BytesRefArray
clear
in interface SortableBytesRefArray
public int append(BytesRef bytes)
BytesRef
to this BytesRefArray
.append
in interface SortableBytesRefArray
bytes
- the bytes to appendpublic int size()
FixedLengthBytesRefArray
size
in interface SortableBytesRefArray
FixedLengthBytesRefArray
private int[] sort(java.util.Comparator<BytesRef> comp)
public BytesRefIterator iterator(java.util.Comparator<BytesRef> comp)
Returns a BytesRefIterator
with point in time semantics. The
iterator provides access to all so far appended BytesRef
instances.
The iterator will iterate the byte values in the order specified by the comparator.
This is a non-destructive operation.
iterator
in interface SortableBytesRefArray