Package com.ibm.icu.impl
Class UResource.Key
java.lang.Object
com.ibm.icu.impl.UResource.Key
- All Implemented Interfaces:
CharSequence
,Cloneable
,Comparable<UResource.Key>
- Enclosing class:
UResource
public static final class UResource.Key
extends Object
implements CharSequence, Cloneable, Comparable<UResource.Key>
Represents a resource bundle item's key string.
Avoids object creations as much as possible.
Mutable, not thread-safe.
For permanent storage, use clone() or toString().
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchar
charAt
(int i) clone()
Does not clone the byte array.int
compareTo
(UResource.Key other) int
boolean
boolean
endsWith
(CharSequence cs) boolean
int
hashCode()
private String
internalSubString
(int start, int end) int
length()
private boolean
regionMatches
(byte[] otherBytes, int otherOffset, int n) boolean
regionMatches
(int start, CharSequence cs) private boolean
regionMatches
(int start, CharSequence cs, int n) setBytes
(byte[] keyBytes, int keyOffset) Mutates this key for a new NUL-terminated resource key string.Mutates this key to be equal to the given string.Mutates this key to an empty resource key string.boolean
subSequence
(int start, int end) substring
(int start) Creates a new Java String for a sub-sequence of this resource key string.substring
(int start, int end) Creates a new Java String for a sub-sequence of this resource key string.toString()
Creates/caches/returns this resource key string as a Java String.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
bytes
private byte[] bytes -
offset
private int offset -
length
private int length -
s
-
-
Constructor Details
-
Key
public Key()Constructs an empty resource key string object. -
Key
Constructs a resource key object equal to the given string. -
Key
private Key(byte[] keyBytes, int keyOffset, int keyLength)
-
-
Method Details
-
setBytes
Mutates this key for a new NUL-terminated resource key string. The corresponding ASCII-character bytes are not copied and must not be changed during the lifetime of this key (or until the next setBytes() call) and lifetimes of subSequences created from this key.- Parameters:
keyBytes
- new key string byte arraykeyOffset
- new key string offset
-
setToEmpty
Mutates this key to an empty resource key string. -
setString
Mutates this key to be equal to the given string. -
clone
Does not clone the byte array. -
charAt
public char charAt(int i) - Specified by:
charAt
in interfaceCharSequence
-
length
public int length()- Specified by:
length
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
toString
Creates/caches/returns this resource key string as a Java String.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
internalSubString
-
substring
Creates a new Java String for a sub-sequence of this resource key string. -
substring
Creates a new Java String for a sub-sequence of this resource key string. -
regionMatches
private boolean regionMatches(byte[] otherBytes, int otherOffset, int n) -
regionMatches
-
equals
-
contentEquals
-
startsWith
-
endsWith
-
regionMatches
- Returns:
- true if the substring of this key starting from the offset contains the same characters as the other sequence.
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<UResource.Key>
-
compareTo
-