Top Description Inners Constructors Methods
com.ibm.icu.impl

public final Class UResource

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, com.ibm.icu.util.UResourceBundle, .UResourceTypeMismatchException

ICU resource bundle key and value types.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
UResource.Array

Interface for iterating over a resource bundle array resource.

public static class
UResource.Key

Represents a resource bundle item's key string.

public abstract static class
UResource.Sink

Sink for ICU resource bundle contents.

public static interface
UResource.Table

Interface for iterating over a resource bundle table resource.

public abstract static class
UResource.Value

Represents a resource bundle item's value.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

UResourceback to summary
public UResource()
com.ibm.icu.impl back to summary

public Interface UResource.Array

Known Direct Implementers
com.ibm.icu.impl.ICUResourceBundleReader.Array

Interface for iterating over a resource bundle array resource. Does not use Java Iterator to reduce object creations.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The number of items in the array resource.
getSize
()

public boolean

Returns:

true if i is non-negative and less than getSize().
getValue
(int
Array item index.
i
,
UResource.Value
Output-only, receives the value of the i'th item.
value
)

Method Detail

getSizeback to summary
public int getSize()
Returns:int

The number of items in the array resource.

getValueback to summary
public boolean getValue(int i, UResource.Value value)
Parameters
i:int

Array item index.

value:UResource.Value

Output-only, receives the value of the i'th item.

Returns:boolean

true if i is non-negative and less than getSize().

com.ibm.icu.impl back to summary

public final Class UResource.Key

extends Object
implements CharSequence, Cloneable, Comparable<UResource.Key>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable, java.lang.Cloneable, java.lang.CharSequence

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

Modifier and TypeField and Description
private byte[]
private int
private int
private String
s

Constructor Summary

AccessConstructor and Description
public
Key()

Constructs an empty resource key string object.

public
Key(String s)

Constructs a resource key object equal to the given string.

private
Key(byte[] keyBytes, int keyOffset, int keyLength)

Method Summary

Modifier and TypeMethod and Description
public char
charAt(int
the index of the char value to be returned
i
)

Implements java.lang.CharSequence.charAt.

Returns the char value at the specified index.
public UResource.Key
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public int
compareTo(UResource.Key
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public int
compareTo(CharSequence
the object to be compared.
cs
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public boolean
public boolean
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
private String
internalSubString(int start, int end)

public int
length()

Implements java.lang.CharSequence.length.

Returns the length of this character sequence.
private boolean
regionMatches(byte[] otherBytes, int otherOffset, int n)

private boolean
regionMatches(int start, CharSequence cs, int n)

public boolean

Returns:

true if the substring of this key starting from the offset contains the same characters as the other sequence.
regionMatches
(int start, CharSequence cs)

public UResource.Key
setBytes(byte[]
new key string byte array
keyBytes
,
int
new key string offset
keyOffset
)

Mutates this key for a new NUL-terminated resource key string.

public UResource.Key
setString(String s)

Mutates this key to be equal to the given string.

public UResource.Key
setToEmpty()

Mutates this key to an empty resource key string.

public boolean
public UResource.Key
subSequence(int
the start index, inclusive
start
,
int
the end index, exclusive
end
)

Implements java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence.
public String
substring(int start)

Creates a new Java String for a sub-sequence of this resource key string.

public String
substring(int start, int end)

Creates a new Java String for a sub-sequence of this resource key string.

public String
toString()

Overrides java.lang.Object.toString.

Implements java.lang.CharSequence.toString.

Creates/caches/returns this resource key string as a Java String.
Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

bytesback to summary
private byte[] bytes
lengthback to summary
private int length
offsetback to summary
private int offset
sback to summary
private String s

Constructor Detail

Keyback to summary
public Key()

Constructs an empty resource key string object.

Keyback to summary
public Key(String s)

Constructs a resource key object equal to the given string.

Keyback to summary
private Key(byte[] keyBytes, int keyOffset, int keyLength)

Method Detail

charAtback to summary
public char charAt(int i)

Implements java.lang.CharSequence.charAt.

Doc from java.lang.CharSequence.charAt.

Returns the char value at the specified index. An index ranges from zero to length() - 1. The first char value of the sequence is at index zero, the next at index one, and so on, as for array indexing.

If the char value specified by the index is a surrogate, the surrogate value is returned.

Parameters
i:int

the index of the char value to be returned

Returns:char

the specified char value

Annotations
@Override
cloneback to summary
public UResource.Key clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified. Does not clone the byte array.

Returns:UResource.Key

a clone of this instance.

Annotations
@Override
compareToback to summary
public int compareTo(UResource.Key other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:UResource.Key

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
compareToback to summary
public int compareTo(CharSequence cs)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
cs:CharSequence

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

contentEqualsback to summary
public boolean contentEquals(CharSequence cs)
endsWithback to summary
public boolean endsWith(CharSequence cs)
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
internalSubStringback to summary
private String internalSubString(int start, int end)
lengthback to summary
public int length()

Implements java.lang.CharSequence.length.

Doc from java.lang.CharSequence.length.

Returns the length of this character sequence. The length is the number of 16-bit chars in the sequence.

Returns:int

the number of chars in this sequence

Annotations
@Override
regionMatchesback to summary
private boolean regionMatches(byte[] otherBytes, int otherOffset, int n)
regionMatchesback to summary
private boolean regionMatches(int start, CharSequence cs, int n)
regionMatchesback to summary
public boolean regionMatches(int start, CharSequence cs)
Returns:boolean

true if the substring of this key starting from the offset contains the same characters as the other sequence.

setBytesback to summary
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:byte[]

new key string byte array

keyOffset:int

new key string offset

setStringback to summary
public UResource.Key setString(String s)

Mutates this key to be equal to the given string.

setToEmptyback to summary
public UResource.Key setToEmpty()

Mutates this key to an empty resource key string.

startsWithback to summary
public boolean startsWith(CharSequence cs)
subSequenceback to summary
public UResource.Key subSequence(int start, int end)

Implements java.lang.CharSequence.subSequence.

Doc from java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence. The subsequence starts with the char value at the specified index and ends with the char value at index end - 1. The length (in chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.

Parameters
start:int

the start index, inclusive

end:int

the end index, exclusive

Returns:UResource.Key

the specified subsequence

Annotations
@Override
substringback to summary
public String substring(int start)

Creates a new Java String for a sub-sequence of this resource key string.

substringback to summary
public String substring(int start, int end)

Creates a new Java String for a sub-sequence of this resource key string.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements java.lang.CharSequence.toString.

Creates/caches/returns this resource key string as a Java String.

Returns:String

Doc from java.lang.CharSequence.toString.

a string consisting of exactly this sequence of characters

Annotations
@Override
com.ibm.icu.impl back to summary

public abstract Class UResource.Sink

extends Object
Class Inheritance
Known Direct Subclasses
com.ibm.icu.impl.RelativeDateFormat.RelDateFmtDataSink, com.ibm.icu.impl.StaticUnicodeSets.ParseDataSink, com.ibm.icu.impl.number.CompactData.CompactDataSink, com.ibm.icu.impl.number.LongNameHandler.InflectedPluralSink, com.ibm.icu.impl.number.LongNameHandler.PluralTableSink, com.ibm.icu.impl.number.LongNameHandler.AliasSink, com.ibm.icu.impl.number.range.StandardPluralRanges.PluralRangeSetsDataSink, com.ibm.icu.impl.number.range.StandardPluralRanges.PluralRangesDataSink, com.ibm.icu.impl.units.ConversionRates.ConversionRatesSink, com.ibm.icu.impl.units.UnitPreferences.UnitPreferencesSink, com.ibm.icu.impl.units.UnitsData.SimpleUnitIdentifiersSink, com.ibm.icu.impl.units.UnitsData.CategoriesSink, com.ibm.icu.number.NumberRangeFormatterImpl.NumberRangeDataSink, com.ibm.icu.text.RelativeDateTimeFormatter.RelDateTimeDataSink, com.ibm.icu.text.DecimalFormatSymbols.DecFmtDataSink, com.ibm.icu.text.TimeUnitFormat.TimeUnitFormatSetupSink, com.ibm.icu.text.DateTimePatternGenerator.AppendItemFormatsSink, com.ibm.icu.text.DateTimePatternGenerator.AppendItemNamesSink, com.ibm.icu.text.DateTimePatternGenerator.AvailableFormatsSink, com.ibm.icu.text.DateTimePatternGenerator.DayPeriodAllowedHoursSink, com.ibm.icu.text.Collator.KeywordsSink, com.ibm.icu.text.DateFormatSymbols.CalendarDataSink, com.ibm.icu.text.DateIntervalInfo.DateIntervalSink, com.ibm.icu.util.MeasureUnit.MeasureUnitSink, com.ibm.icu.util.MeasureUnit.CurrencyNumericCodeSink, com.ibm.icu.impl.CalendarUtil.CalendarPreferences, com.ibm.icu.impl.DayPeriodRules.DayPeriodRulesDataSink, com.ibm.icu.impl.DayPeriodRules.DayPeriodRulesCountSink, com.ibm.icu.impl.ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.CurrencySink, com.ibm.icu.impl.ICUResourceBundle.AvailableLocalesSink, com.ibm.icu.impl.LocaleDisplayNamesImpl.CapitalizationContextSink, com.ibm.icu.impl.TimeZoneNamesImpl.ZoneStringsLoader, com.ibm.icu.impl.TimeZoneNamesImpl.ZNamesLoader

Sink for ICU resource bundle contents.

Constructor Summary

AccessConstructor and Description
public
Sink()

Method Summary

Modifier and TypeMethod and Description
public abstract void
put(UResource.Key
Initially the key string of the enumeration-start resource. Empty if the enumeration starts at the top level of the bundle. Reuse for output values from Array and Table getters.
key
,
UResource.Value
Call getArray() or getTable() as appropriate. Then reuse for output values from Array and Table getters.
value
,
boolean
true if the bundle has no parent; that is, its top-level table has the nofallback attribute, or it is the root bundle of a locale tree.
noFallback
)

Called once for each bundle (child-parent-...-root).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Sinkback to summary
public Sink()

Method Detail

putback to summary
public abstract void put(UResource.Key key, UResource.Value value, boolean noFallback)

Called once for each bundle (child-parent-...-root). The value is normally an array or table resource, and implementations of this method normally iterate over the tree of resource items stored there.

Parameters
key:UResource.Key

Initially the key string of the enumeration-start resource. Empty if the enumeration starts at the top level of the bundle. Reuse for output values from Array and Table getters.

value:UResource.Value

Call getArray() or getTable() as appropriate. Then reuse for output values from Array and Table getters.

noFallback:boolean

true if the bundle has no parent; that is, its top-level table has the nofallback attribute, or it is the root bundle of a locale tree.

com.ibm.icu.impl back to summary

public Interface UResource.Table

Known Direct Implementers
com.ibm.icu.impl.ICUResourceBundleReader.Table

Interface for iterating over a resource bundle table resource. Does not use Java Iterator to reduce object creations.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the table contains the key.
findValue
(CharSequence
Key string to find in the table.
key
,
UResource.Value
Output-only, receives the value of the item with that key.
value
)

public boolean

Returns:

true if i is non-negative and less than getSize().
getKeyAndValue
(int
Table item index.
i
,
UResource.Key
Output-only, receives the key of the i'th item.
key
,
UResource.Value
Output-only, receives the value of the i'th item.
value
)

public int

Returns:

The number of items in the table resource.
getSize
()

Method Detail

findValueback to summary
public boolean findValue(CharSequence key, UResource.Value value)
Parameters
key:CharSequence

Key string to find in the table.

value:UResource.Value

Output-only, receives the value of the item with that key.

Returns:boolean

true if the table contains the key.

getKeyAndValueback to summary
public boolean getKeyAndValue(int i, UResource.Key key, UResource.Value value)
Parameters
i:int

Table item index.

key:UResource.Key

Output-only, receives the key of the i'th item.

value:UResource.Value

Output-only, receives the value of the i'th item.

Returns:boolean

true if i is non-negative and less than getSize().

getSizeback to summary
public int getSize()
Returns:int

The number of items in the table resource.

com.ibm.icu.impl back to summary

public abstract Class UResource.Value

extends Object
Class Inheritance
Known Direct Subclasses
com.ibm.icu.impl.ICUResourceBundleReader.ReaderValue

Represents a resource bundle item's value. Avoids object creations as much as possible. Mutable, not thread-safe.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public abstract String
public abstract UResource.Array
public abstract ByteBuffer
public abstract int
public abstract int[]
public abstract String
public abstract String[]

Returns:

the array of strings in this array resource.
getStringArray
()

public abstract String[]
getStringArrayOrStringAsArray()

Same as

if (getType() == STRING) {
    return new String[] { getString(); }
} else {
    return getStringArray();
}
public abstract String
getStringOrFirstOfArray()

Same as

if (getType() == STRING) {
    return getString();
} else {
    return getStringArray()[0];
}
public abstract UResource.Table
public abstract int

Returns:

ICU resource type like UResourceBundle#getType(), for example, UResourceBundle#STRING
getType
()

public abstract int
public abstract boolean

Returns:

true if this is a no-inheritance marker string
isNoInheritanceMarker
()

Is this a no-fallback/no-inheritance marker string?

public String
toString()

Overrides java.lang.Object.toString.

Only for debugging.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Constructor Detail

Valueback to summary
protected Value()

Method Detail

getAliasStringback to summary
public abstract String getAliasString()
Exceptions
UResourceTypeMismatchException:
if this is not an alias resource
getArrayback to summary
public abstract UResource.Array getArray()
Exceptions
UResourceTypeMismatchException:
if this is not an array resource
getBinaryback to summary
public abstract ByteBuffer getBinary()
Exceptions
UResourceTypeMismatchException:
if this is not a binary-blob resource
See Also
UResourceBundle#getBinary()
getIntback to summary
public abstract int getInt()
Exceptions
UResourceTypeMismatchException:
if this is not an integer resource
See Also
UResourceBundle#getInt()
getIntVectorback to summary
public abstract int[] getIntVector()
Exceptions
UResourceTypeMismatchException:
if this is not an intvector resource
See Also
UResourceBundle#getIntVector()
getStringback to summary
public abstract String getString()
Exceptions
UResourceTypeMismatchException:
if this is not a string resource
See Also
UResourceBundle#getString()
getStringArrayback to summary
public abstract String[] getStringArray()
Returns:String[]

the array of strings in this array resource.

Exceptions
UResourceTypeMismatchException:
if this is not an array resource or if any of the array items is not a string
See Also
UResourceBundle#getStringArray()
getStringArrayOrStringAsArrayback to summary
public abstract String[] getStringArrayOrStringAsArray()

Same as

if (getType() == STRING) {
    return new String[] { getString(); }
} else {
    return getStringArray();
}
Exceptions
UResourceTypeMismatchException:
if this is neither a string resource nor an array resource containing strings
See Also
getString(), getStringArray()
getStringOrFirstOfArrayback to summary
public abstract String getStringOrFirstOfArray()

Same as

if (getType() == STRING) {
    return getString();
} else {
    return getStringArray()[0];
}
Exceptions
UResourceTypeMismatchException:
if this is neither a string resource nor an array resource containing strings
See Also
getString(), getStringArray()
getTableback to summary
public abstract UResource.Table getTable()
Exceptions
UResourceTypeMismatchException:
if this is not a table resource
getTypeback to summary
public abstract int getType()
Returns:int

ICU resource type like UResourceBundle#getType(), for example, UResourceBundle#STRING

getUIntback to summary
public abstract int getUInt()
Exceptions
UResourceTypeMismatchException:
if this is not an integer resource
See Also
UResourceBundle#getUInt()
isNoInheritanceMarkerback to summary
public abstract boolean isNoInheritanceMarker()

Is this a no-fallback/no-inheritance marker string? Such a marker is used for CLDR no-fallback data values of "∅∅∅" when enumerating tables with fallback from the specific resource bundle to root.

Returns:boolean

true if this is a no-inheritance marker string

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Only for debugging.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override