Package com.ibm.icu.impl
Class UResource.Key
- java.lang.Object
-
- com.ibm.icu.impl.UResource.Key
-
- All Implemented Interfaces:
java.lang.CharSequence
,java.lang.Cloneable
,java.lang.Comparable<UResource.Key>
- Enclosing class:
- UResource
public static final class UResource.Key extends java.lang.Object implements java.lang.CharSequence, java.lang.Cloneable, java.lang.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().
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
charAt(int i)
UResource.Key
clone()
Does not clone the byte array.int
compareTo(UResource.Key other)
int
compareTo(java.lang.CharSequence cs)
boolean
contentEquals(java.lang.CharSequence cs)
boolean
endsWith(java.lang.CharSequence cs)
boolean
equals(java.lang.Object other)
int
hashCode()
private java.lang.String
internalSubString(int start, int end)
int
length()
private boolean
regionMatches(byte[] otherBytes, int otherOffset, int n)
boolean
regionMatches(int start, java.lang.CharSequence cs)
private boolean
regionMatches(int start, java.lang.CharSequence cs, int n)
UResource.Key
setBytes(byte[] keyBytes, int keyOffset)
Mutates this key for a new NUL-terminated resource key string.UResource.Key
setString(java.lang.String s)
Mutates this key to be equal to the given string.UResource.Key
setToEmpty()
Mutates this key to an empty resource key string.boolean
startsWith(java.lang.CharSequence cs)
UResource.Key
subSequence(int start, int end)
java.lang.String
substring(int start)
Creates a new Java String for a sub-sequence of this resource key string.java.lang.String
substring(int start, int end)
Creates a new Java String for a sub-sequence of this resource key string.java.lang.String
toString()
Creates/caches/returns this resource key string as a Java String.
-
-
-
Method Detail
-
setBytes
public UResource.Key setBytes(byte[] keyBytes, int keyOffset)
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
public UResource.Key setToEmpty()
Mutates this key to an empty resource key string.
-
setString
public UResource.Key setString(java.lang.String s)
Mutates this key to be equal to the given string.
-
clone
public UResource.Key clone()
Does not clone the byte array.- Overrides:
clone
in classjava.lang.Object
-
charAt
public char charAt(int i)
- Specified by:
charAt
in interfacejava.lang.CharSequence
-
length
public int length()
- Specified by:
length
in interfacejava.lang.CharSequence
-
subSequence
public UResource.Key subSequence(int start, int end)
- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
toString
public java.lang.String toString()
Creates/caches/returns this resource key string as a Java String.- Specified by:
toString
in interfacejava.lang.CharSequence
- Overrides:
toString
in classjava.lang.Object
-
internalSubString
private java.lang.String internalSubString(int start, int end)
-
substring
public java.lang.String substring(int start)
Creates a new Java String for a sub-sequence of this resource key string.
-
substring
public java.lang.String substring(int start, int end)
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
private boolean regionMatches(int start, java.lang.CharSequence cs, int n)
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
contentEquals
public boolean contentEquals(java.lang.CharSequence cs)
-
startsWith
public boolean startsWith(java.lang.CharSequence cs)
-
endsWith
public boolean endsWith(java.lang.CharSequence cs)
-
regionMatches
public boolean regionMatches(int start, java.lang.CharSequence cs)
- Returns:
- true if the substring of this key starting from the offset contains the same characters as the other sequence.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(UResource.Key other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<UResource.Key>
-
compareTo
public int compareTo(java.lang.CharSequence cs)
-
-