public final class BytesRefList extends Object
BytesRef
array that stores full
copies of the appended bytes in a ByteBlockPool
.
Note: This class is not Thread-Safe!Constructor and Description |
---|
BytesRefList()
Creates a new
BytesRefList |
Modifier and Type | Method and Description |
---|---|
int |
append(BytesRef bytes)
Appends a copy of the given
BytesRef to this BytesRefList . |
long |
bytesUsed()
Returns the number internally used bytes to hold the appended bytes in
memory
|
void |
clear()
Clears this
BytesRefList |
BytesRef |
get(BytesRef spare,
int ord)
Returns the n'th element of this
BytesRefList |
BytesRefIterator |
iterator()
sugar for
iterator(Comparator) with a null comparator |
BytesRefIterator |
iterator(Comparator<BytesRef> comp)
Returns a
BytesRefIterator with point in time semantics. |
int |
size()
Returns the current size of this
BytesRefList |
public BytesRefList()
BytesRefList
public void clear()
BytesRefList
public int append(BytesRef bytes)
BytesRef
to this BytesRefList
.bytes
- the bytes to appendpublic int size()
BytesRefList
BytesRefList
public BytesRef get(BytesRef spare, int ord)
BytesRefList
spare
- a spare BytesRef
instanceord
- the elements ordinal to retrieveBytesRefList
public long bytesUsed()
public BytesRefIterator iterator()
iterator(Comparator)
with a null
comparatorpublic BytesRefIterator iterator(Comparator<BytesRef> comp)
Returns a BytesRefIterator
with point in time semantics. The
iterator provides access to all so far appended BytesRef
instances.
If a non null
Comparator
is provided the iterator will
iterate the byte values in the order specified by the comparator. Otherwise
the order is the same as the values were appended.
This is a non-destructive operation.