BytesRefBlockPool

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 -2 bytes.

Constructors

Link copied to clipboard
constructor()
constructor(byteBlockPool: ByteBlockPool)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Functions

Link copied to clipboard
fun addBytesRef(bytes: BytesRef): Int

Add a term returning the start position on the underlying ByteBlockPool. THis can be used to read back the value using .fillBytesRef.

Link copied to clipboard
fun equals(start: Int, b: BytesRef): Boolean

Computes the equality between the BytesRef at the start position with the provided BytesRef. This is equivalent of doing:

Link copied to clipboard
fun fillBytesRef(term: BytesRef, start: Int)

Populates the given BytesRef with the term starting at start.

Link copied to clipboard
fun hash(start: Int): Int

Computes the hash of the BytesRef at the given start. This is equivalent of doing:

Link copied to clipboard
open override fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard
fun reset()

Reset this buffer to the empty state.