public static final class ICUResource.Key extends Object implements CharSequence, Cloneable, Comparable<ICUResource.Key>
| Constructor and Description |
|---|
Key()
Constructs an empty resource key string object.
|
| Modifier and Type | Method and Description |
|---|---|
char |
charAt(int i)
Returns the character at
index. |
ICUResource.Key |
clone()
Creates and returns a copy of this
Object. |
int |
compareTo(CharSequence cs) |
int |
compareTo(ICUResource.Key other)
Compares this object to the specified object to determine their relative
order.
|
boolean |
contentEquals(CharSequence cs) |
boolean |
endsWith(CharSequence cs) |
boolean |
equals(Object other)
Compares this instance with the specified object and indicates if they
are equal.
|
int |
hashCode()
Returns an integer hash code for this object.
|
int |
length()
Returns the number of characters in this sequence.
|
void |
setBytes(byte[] keyBytes,
int keyOffset)
Mutates this key for a new NUL-terminated resource key string.
|
void |
setToEmpty()
Mutates this key to an empty resource key string.
|
boolean |
startsWith(CharSequence cs) |
ICUResource.Key |
subSequence(int start,
int end)
Returns a
CharSequence from the start index (inclusive)
to the end index (exclusive) of this sequence. |
String |
substring(int start)
Creates a new Java String for a sub-sequence of this resource key string.
|
String |
substring(int start,
int end)
Creates a new Java String for a sub-sequence of this resource key string.
|
String |
toString()
Creates/caches/returns this resource key string as a Java String.
|
public void setBytes(byte[] keyBytes,
int keyOffset)
keyBytes - new key string byte arraykeyOffset - new key string offsetpublic void setToEmpty()
public ICUResource.Key clone()
Object. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.
Does not clone the byte array.public char charAt(int i)
CharSequenceindex.charAt in interface CharSequencepublic int length()
CharSequencelength in interface CharSequencepublic ICUResource.Key subSequence(int start, int end)
CharSequenceCharSequence from the start index (inclusive)
to the end index (exclusive) of this sequence.subSequence in interface CharSequencestart - the start offset of the sub-sequence. It is inclusive, that
is, the index of the first character that is included in the
sub-sequence.end - the end offset of the sub-sequence. It is exclusive, that is,
the index of the first character after those that are included
in the sub-sequencepublic String toString()
toString in interface CharSequencetoString in class Objectpublic String substring(int start)
public String substring(int start, int end)
public boolean equals(Object other)
Objecto must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns true only if this ==
o. See Writing a correct
equals method
if you intend implementing your own equals method.
The general contract for the equals and Object.hashCode() methods is that if equals returns true for
any two objects, then hashCode() must return the same value for
these objects. This means that subclasses of Object usually
override either both methods or neither of them.
equals in class Objectother - the object to compare this instance with.true if the specified object is equal to this Object; false otherwise.Object.hashCode()public boolean contentEquals(CharSequence cs)
public boolean startsWith(CharSequence cs)
public boolean endsWith(CharSequence cs)
public int hashCode()
ObjectObject.equals(java.lang.Object) returns true must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode method
if you intend implementing your own hashCode method.
hashCode in class ObjectObject.equals(java.lang.Object)public int compareTo(ICUResource.Key other)
ComparablecompareTo in interface Comparable<ICUResource.Key>other - the object to compare to this instance.another;
a positive integer if this instance is greater than
another; 0 if this instance has the same order as
another.public int compareTo(CharSequence cs)