Package org.apache.lucene.util
Class CharsRefBuilder
java.lang.Object
org.apache.lucene.util.CharsRefBuilder
- All Implemented Interfaces:
Appendable
A builder for
CharsRef
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 TypeMethodDescriptionappend
(char c) void
append
(char[] otherChars, int otherOffset, int otherLength) Appends the given array to this CharsRefappend
(CharSequence csq) append
(CharSequence csq, int start, int end) char
charAt
(int offset) Return the char at the given offset.char[]
chars()
Return a reference to the chars of this builder.void
clear()
Reset this builder to the empty state.void
copyChars
(char[] otherChars, int otherOffset, int otherLength) Copies the given array into this instance.void
Copies the givenCharsRef
referenced content into this instance.void
copyUTF8Bytes
(byte[] bytes, int offset, int length) Copy the provided bytes, interpreted as UTF-8 bytes.void
copyUTF8Bytes
(BytesRef bytes) Copy the provided bytes, interpreted as UTF-8 bytes.boolean
get()
Return aCharsRef
that points to the internal content of this builder.void
grow
(int newLength) Used to grow the reference array.int
hashCode()
int
length()
Return the number of chars in this buffer.void
setCharAt
(int offset, char b) Set a char.void
setLength
(int length) Set the length.Build a newCharsRef
that has the same content as this builder.toString()
-
Constructor Details
-
CharsRefBuilder
public CharsRefBuilder()Sole constructor.
-
-
Method Details
-
chars
public char[] chars()Return a reference to the chars of this builder. -
length
public int length()Return the number of chars in this buffer. -
setLength
public void setLength(int length) Set the length. -
charAt
public char charAt(int offset) Return the char at the given offset. -
setCharAt
public void setCharAt(int offset, char b) Set a char. -
clear
public void clear()Reset this builder to the empty state. -
append
- Specified by:
append
in interfaceAppendable
-
append
- Specified by:
append
in interfaceAppendable
-
append
- Specified by:
append
in interfaceAppendable
-
copyChars
Copies the givenCharsRef
referenced content into this instance. -
grow
public void grow(int newLength) Used to grow the reference array. -
copyUTF8Bytes
public void copyUTF8Bytes(byte[] bytes, int offset, int length) Copy the provided bytes, interpreted as UTF-8 bytes. -
copyUTF8Bytes
Copy the provided bytes, interpreted as UTF-8 bytes. -
copyChars
public void copyChars(char[] otherChars, int otherOffset, int otherLength) Copies the given array into this instance. -
append
public void append(char[] otherChars, int otherOffset, int otherLength) Appends the given array to this CharsRef -
get
Return aCharsRef
that points to the internal content of this builder. Any update to the content of this builder might invalidate the providedref
and vice-versa. -
toCharsRef
Build a newCharsRef
that has the same content as this builder. -
toString
-
equals
-
hashCode
public int hashCode()
-