Package org.apache.lucene.util
Class BytesRefBuilder
java.lang.Object
org.apache.lucene.util.BytesRefBuilder
A builder for
BytesRef
instances.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(byte b) Append a single byte to this builder.void
append
(byte[] b, int off, int len) Append the provided bytes to this builder.void
Append the provided bytes to this builder.void
append
(BytesRefBuilder builder) Append the provided bytes to this builder.byte
byteAt
(int offset) Return the byte at the given offset.byte[]
bytes()
Return a reference to the bytes of this builder.void
clear()
Reset this builder to the empty state.void
copyBytes
(byte[] b, int off, int len) Replace the content of this builder with the provided bytes.void
Replace the content of this builder with the provided bytes.void
copyBytes
(BytesRefBuilder builder) Replace the content of this builder with the provided bytes.void
copyChars
(char[] text, int off, int len) Replace the content of this buffer with UTF-8 encoded bytes that would represent the provided text.void
copyChars
(CharSequence text) Replace the content of this buffer with UTF-8 encoded bytes that would represent the provided text.void
copyChars
(CharSequence text, int off, int len) Replace the content of this buffer with UTF-8 encoded bytes that would represent the provided text.boolean
get()
Return aBytesRef
that points to the internal content of this builder.void
grow
(int capacity) Ensure that this builder can hold at leastcapacity
bytes without resizing.int
hashCode()
int
length()
Return the number of bytes in this buffer.void
setByteAt
(int offset, byte b) Set a byte.void
setLength
(int length) Set the length.Build a newBytesRef
that has the same content as this buffer.
-
Constructor Details
-
BytesRefBuilder
public BytesRefBuilder()Sole constructor.
-
-
Method Details
-
bytes
public byte[] bytes()Return a reference to the bytes of this builder. -
length
public int length()Return the number of bytes in this buffer. -
setLength
public void setLength(int length) Set the length. -
byteAt
public byte byteAt(int offset) Return the byte at the given offset. -
setByteAt
public void setByteAt(int offset, byte b) Set a byte. -
grow
public void grow(int capacity) Ensure that this builder can hold at leastcapacity
bytes without resizing. -
append
public void append(byte b) Append a single byte to this builder. -
append
public void append(byte[] b, int off, int len) Append the provided bytes to this builder. -
append
Append the provided bytes to this builder. -
append
Append the provided bytes to this builder. -
clear
public void clear()Reset this builder to the empty state. -
copyBytes
public void copyBytes(byte[] b, int off, int len) Replace the content of this builder with the provided bytes. Equivalent to callingclear()
and thenappend(byte[], int, int)
. -
copyBytes
Replace the content of this builder with the provided bytes. Equivalent to callingclear()
and thenappend(BytesRef)
. -
copyBytes
Replace the content of this builder with the provided bytes. Equivalent to callingclear()
and thenappend(BytesRefBuilder)
. -
copyChars
Replace the content of this buffer with UTF-8 encoded bytes that would represent the provided text. -
copyChars
Replace the content of this buffer with UTF-8 encoded bytes that would represent the provided text. -
copyChars
public void copyChars(char[] text, int off, int len) Replace the content of this buffer with UTF-8 encoded bytes that would represent the provided text. -
get
Return aBytesRef
that points to the internal content of this builder. Any update to the content of this builder might invalidate the providedref
and vice-versa. -
toBytesRef
Build a newBytesRef
that has the same content as this buffer. -
equals
-
hashCode
public int hashCode()
-