public final class CharsRef extends Object implements Comparable<CharsRef>, CharSequence, Cloneable
chars
member should never be null; use
EMPTY_CHARS
if necessary.Modifier and Type | Field and Description |
---|---|
char[] |
chars
The contents of the CharsRef.
|
static char[] |
EMPTY_CHARS
An empty character array for convenience
|
int |
length
Length of used characters.
|
int |
offset
Offset of first valid character.
|
Constructor and Description |
---|
CharsRef()
Creates a new
CharsRef initialized an empty array zero-length |
CharsRef(char[] chars,
int offset,
int length)
Creates a new
CharsRef initialized with the given array, offset and
length |
CharsRef(int capacity)
Creates a new
CharsRef initialized with an array of the given
capacity |
CharsRef(String string)
Creates a new
CharsRef initialized with the given Strings character
array |
Modifier and Type | Method and Description |
---|---|
void |
append(char[] otherChars,
int otherOffset,
int otherLength)
Deprecated.
CharsRef should not be used as a buffer, use CharsRefBuilder instead |
char |
charAt(int index) |
boolean |
charsEquals(CharsRef other) |
CharsRef |
clone()
Returns a shallow clone of this instance (the underlying characters are
not copied and will be shared by both the returned object and this
object.
|
int |
compareTo(CharsRef other)
Signed int order comparison
|
void |
copyChars(char[] otherChars,
int otherOffset,
int otherLength)
Deprecated.
CharsRef should not be used as a buffer, use CharsRefBuilder instead |
void |
copyChars(CharsRef other)
Deprecated.
CharsRef should not be used as a buffer, use CharsRefBuilder instead |
static CharsRef |
deepCopyOf(CharsRef other)
Creates a new CharsRef that points to a copy of the chars from
other |
boolean |
equals(Object other) |
static Comparator<CharsRef> |
getUTF16SortedAsUTF8Comparator()
Deprecated.
This comparator is only a transition mechanism
|
void |
grow(int newLength)
Deprecated.
CharsRef should not be used as a buffer, use CharsRefBuilder instead |
int |
hashCode() |
boolean |
isValid()
Performs internal consistency checks.
|
int |
length() |
CharSequence |
subSequence(int start,
int end) |
String |
toString() |
public static final char[] EMPTY_CHARS
public char[] chars
null
.public int offset
public int length
public CharsRef()
CharsRef
initialized an empty array zero-lengthpublic CharsRef(int capacity)
CharsRef
initialized with an array of the given
capacitypublic CharsRef(char[] chars, int offset, int length)
CharsRef
initialized with the given array, offset and
lengthpublic CharsRef clone()
clone
in class Object
deepCopyOf(org.apache.lucene.util.CharsRef)
public boolean charsEquals(CharsRef other)
public int compareTo(CharsRef other)
compareTo
in interface Comparable<CharsRef>
@Deprecated public void copyChars(CharsRef other)
CharsRef
referenced content into this instance.other
- the CharsRef
to copy@Deprecated public void grow(int newLength)
@Deprecated public void copyChars(char[] otherChars, int otherOffset, int otherLength)
@Deprecated public void append(char[] otherChars, int otherOffset, int otherLength)
public String toString()
toString
in interface CharSequence
toString
in class Object
public int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
@Deprecated public static Comparator<CharsRef> getUTF16SortedAsUTF8Comparator()
public static CharsRef deepCopyOf(CharsRef other)
other
The returned CharsRef will have a length of other.length and an offset of zero.
public boolean isValid()
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.