Package org.apache.lucene.util
Class CharsRefBuilder
- java.lang.Object
-
- org.apache.lucene.util.CharsRefBuilder
-
- All Implemented Interfaces:
java.lang.Appendable
public class CharsRefBuilder extends java.lang.Object implements java.lang.AppendableA builder forCharsRefinstances.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringNULL_STRINGprivate CharsRefref
-
Constructor Summary
Constructors Constructor Description CharsRefBuilder()Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CharsRefBuilderappend(char c)voidappend(char[] otherChars, int otherOffset, int otherLength)Appends the given array to this CharsRefCharsRefBuilderappend(java.lang.CharSequence csq)CharsRefBuilderappend(java.lang.CharSequence csq, int start, int end)charcharAt(int offset)Return the char at the given offset.char[]chars()Return a reference to the chars of this builder.voidclear()Reset this builder to the empty state.voidcopyChars(char[] otherChars, int otherOffset, int otherLength)Copies the given array into this instance.voidcopyChars(CharsRef other)Copies the givenCharsRefreferenced content into this instance.voidcopyUTF8Bytes(byte[] bytes, int offset, int length)Copy the provided bytes, interpreted as UTF-8 bytes.voidcopyUTF8Bytes(BytesRef bytes)Copy the provided bytes, interpreted as UTF-8 bytes.booleanequals(java.lang.Object obj)CharsRefget()Return aCharsRefthat points to the internal content of this builder.voidgrow(int newLength)Used to grow the reference array.inthashCode()intlength()Return the number of chars in this buffer.voidsetCharAt(int offset, char b)Set a char.voidsetLength(int length)Set the length.CharsReftoCharsRef()Build a newCharsRefthat has the same content as this builder.java.lang.StringtoString()
-
-
-
Field Detail
-
NULL_STRING
private static final java.lang.String NULL_STRING
- See Also:
- Constant Field Values
-
ref
private final CharsRef ref
-
-
Method Detail
-
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
public CharsRefBuilder append(java.lang.CharSequence csq)
- Specified by:
appendin interfacejava.lang.Appendable
-
append
public CharsRefBuilder append(java.lang.CharSequence csq, int start, int end)
- Specified by:
appendin interfacejava.lang.Appendable
-
append
public CharsRefBuilder append(char c)
- Specified by:
appendin interfacejava.lang.Appendable
-
copyChars
public void copyChars(CharsRef other)
Copies the givenCharsRefreferenced 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
public void copyUTF8Bytes(BytesRef bytes)
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
public CharsRef get()
Return aCharsRefthat points to the internal content of this builder. Any update to the content of this builder might invalidate the providedrefand vice-versa.
-
toCharsRef
public CharsRef toCharsRef()
Build a newCharsRefthat has the same content as this builder.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-