Package org.apache.lucene.util
Class BytesRefBlockPool
java.lang.Object
org.apache.lucene.util.BytesRefBlockPool
- All Implemented Interfaces:
Accountable
Represents a logical list of ByteRef backed by a
ByteBlockPool
. It uses up to two bytes
to record the length of the BytesRef followed by the actual bytes. They can be read using the
start position returned when they are appended.
The BytesRef
is written so it never crosses the ByteBlockPool.BYTE_BLOCK_SIZE
boundary. The limit of the largest BytesRef
is therefore ByteBlockPool.BYTE_BLOCK_SIZE
-2 bytes.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
addBytesRef
(BytesRef bytes) Add a term returning the start position on the underlyingByteBlockPool
.void
fillBytesRef
(BytesRef term, int start) Populates the given BytesRef with the term starting at start.long
Return the memory usage of this object in bytes.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Constructor Details
-
BytesRefBlockPool
public BytesRefBlockPool() -
BytesRefBlockPool
-
-
Method Details
-
fillBytesRef
Populates the given BytesRef with the term starting at start.- See Also:
-
addBytesRef
Add a term returning the start position on the underlyingByteBlockPool
. THis can be used to read back the value usingfillBytesRef(BytesRef, int)
.- See Also:
-
ramBytesUsed
public long ramBytesUsed()Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-