BytesRefBuilder

A builder for BytesRef instances.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun append(b: Byte)

Append a single byte to this builder.

fun append(ref: BytesRef)
fun append(builder: BytesRefBuilder)
fun append(b: ByteArray, off: Int, len: Int)

Append the provided bytes to this builder.

Link copied to clipboard
fun byteAt(offset: Int): Byte

Return the byte at the given offset.

Link copied to clipboard

Return a reference to the bytes of this builder.

Link copied to clipboard
fun clear()

Reset this builder to the empty state.

Link copied to clipboard
fun copyBytes(b: ByteArray, off: Int, len: Int)

Replace the content of this builder with the provided bytes. Equivalent to calling .clear and then .append.

Link copied to clipboard
fun copyChars(text: CharArray?, off: Int, len: Int)
fun copyChars(text: CharSequence?, off: Int = 0, len: Int = text!!.length)

Replace the content of this buffer with UTF-8 encoded bytes that would represent the provided text.

Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean
Link copied to clipboard
fun get(): BytesRef

Return a BytesRef that points to the internal content of this builder. Any update to the content of this builder might invalidate the provided ref and vice-versa.

Link copied to clipboard
fun grow(capacity: Int)

Ensure that this builder can hold at least capacity bytes without resizing.

Link copied to clipboard
fun growNoCopy(capacity: Int)

Used to grow the builder without copying bytes. see ArrayUtil.growNoCopy.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun length(): Int

Return the number of bytes in this buffer.

Link copied to clipboard
fun setByteAt(offset: Int, b: Byte)

Set a byte.

Link copied to clipboard
fun setLength(length: Int)

Set the length.

Link copied to clipboard

Build a new BytesRef that has the same content as this buffer.