public class ICUResourceBundle extends UResourceBundle
| Modifier and Type | Class and Description |
|---|---|
static class |
ICUResourceBundle.OpenType |
protected static class |
ICUResourceBundle.WholeBundle
Fields for a whole bundle, rather than any specific resource in the bundle.
|
ResourceBundle.Control| Modifier and Type | Field and Description |
|---|---|
static int |
ALIAS
Resource type constant for aliases;
internally stores a string which identifies the actual resource
storing the data (can be in a different resource bundle).
|
static int |
ARRAY16
Resource type constant for arrays with 16-bit count and values.
|
static int |
FROM_DEFAULT |
static int |
FROM_FALLBACK |
static int |
FROM_LOCALE |
static int |
FROM_ROOT |
static String |
ICU_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_BRKITR_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_BUNDLE
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_COLLATION_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_CURR_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static ClassLoader |
ICU_DATA_CLASS_LOADER
The class loader constant to be used with getBundleInstance API
|
protected static String |
ICU_DATA_PATH
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_LANG_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_RBNF_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_REGION_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_TRANSLIT_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
static String |
ICU_ZONE_BASE_NAME
Deprecated.
because not specific to resource bundles; use the ICUData constants instead
|
protected static String |
INSTALLED_LOCALES
The name of the resource containing the installed locales
|
protected String |
key
Data member where the subclasses store the key.
|
static int |
RES_BOGUS
A resource word value that means "no resource".
|
static int |
STRING_V2
Resource type constant for 16-bit Unicode strings in formatVersion 2.
|
static int |
TABLE16
Resource type constant for tables with 16-bit count, key offsets and values.
|
static int |
TABLE32
Resource type constant for tables with 32-bit count, key offsets and values.
|
ARRAY, BINARY, INT, INT_VECTOR, NONE, STRING, TABLEparent| Modifier | Constructor and Description |
|---|---|
protected |
ICUResourceBundle(ICUResourceBundle.WholeBundle wholeBundle)
Constructor for the root table of a bundle.
|
protected |
ICUResourceBundle(ICUResourceBundle container,
String key) |
| Modifier and Type | Method and Description |
|---|---|
ICUResourceBundle |
at(int index) |
ICUResourceBundle |
at(String key) |
static ICUResourceBundle |
createBundle(String baseName,
String localeID,
ClassLoader root)
Create a bundle using a reader.
|
boolean |
equals(Object other)
Compares this instance with the specified object and indicates if they
are equal.
|
String |
findStringWithFallback(String path) |
ICUResourceBundle |
findTopLevel(int index)
Returns a resource in a given resource that has a given index, or null if the
resource is not found.
|
ICUResourceBundle |
findTopLevel(String aKey)
Returns a resource in a given resource that has a given key, or null if the
resource is not found.
|
ICUResourceBundle |
findWithFallback(String path)
Like getWithFallback, but returns null if the resource is not found instead of
throwing an exception.
|
protected static ICUResourceBundle |
getAliasedResource(ICUResourceBundle base,
String[] keys,
int depth,
String key,
int _resource,
HashMap<String,String> aliasesVisited,
UResourceBundle requested)
Returns the resource object referred to from the alias _resource int's path string.
|
void |
getAllArrayItemsWithFallback(String path,
ICUResource.ArraySink sink) |
void |
getAllTableItemsWithFallback(String path,
ICUResource.TableSink sink) |
static Set<String> |
getAvailableLocaleNameSet()
Return a set of the locale names supported by a collection of resource
bundles.
|
static Set<String> |
getAvailableLocaleNameSet(String bundlePrefix,
ClassLoader loader)
Return a set of the locale names supported by a collection of resource
bundles.
|
static Locale[] |
getAvailableLocales()
Get the set of Locales installed the base bundle.
|
static Locale[] |
getAvailableLocales(String baseName,
ClassLoader loader)
Get the set of Locales installed in the specified bundles.
|
static ULocale[] |
getAvailableULocales()
Get the set of ULocales installed the base bundle.
|
static ULocale[] |
getAvailableULocales(String baseName,
ClassLoader loader)
Get the set of Locales installed in the specified bundles.
|
protected String |
getBaseName()
Returns the base name of the resource bundle
|
static UResourceBundle |
getBundleInstance(String baseName,
String localeID,
ClassLoader root,
boolean disableFallback) |
static UResourceBundle |
getBundleInstance(String baseName,
String localeID,
ClassLoader root,
ICUResourceBundle.OpenType openType) |
static UResourceBundle |
getBundleInstance(String baseName,
ULocale locale,
ICUResourceBundle.OpenType openType) |
static Set<String> |
getFullLocaleNameSet()
Return a set of all the locale names supported by a collection of
resource bundles.
|
static Set<String> |
getFullLocaleNameSet(String bundlePrefix,
ClassLoader loader)
Return a set of all the locale names supported by a collection of
resource bundles.
|
static ULocale |
getFunctionalEquivalent(String baseName,
ClassLoader loader,
String resName,
String keyword,
ULocale locID,
boolean[] isAvailable,
boolean omitDefault)
Returns a functionally equivalent locale, considering keywords as well, for the specified keyword.
|
String |
getKey()
Returns the key associated with a given resource.
|
static String[] |
getKeywordValues(String baseName,
String keyword)
Given a tree path and keyword, return a string enumeration of all possible values for that keyword.
|
int |
getLoadingStatus()
Returns the loading status of a particular resource.
|
Locale |
getLocale()
Returns the locale of this resource bundle.
|
protected String |
getLocaleID()
Returns the localeID
|
static Locale[] |
getLocaleList(ULocale[] ulocales)
Convert a list of ULocales to a list of Locales.
|
UResourceBundle |
getParent()
Returns the parent bundle
|
String |
getStringWithFallback(String path) |
Set<String> |
getTopLevelKeySet()
Deprecated.
This API is ICU internal only.
|
ULocale |
getULocale()
Returns the RFC 3066 conformant locale id of this resource bundle.
|
ICUResourceBundle |
getWithFallback(String path)
This method performs multilevel fallback for fetching items from the
bundle e.g: If resource is in the form de__PHONEBOOK{ collations{
default{ "phonebook"} } } If the value of "default" key needs to be
accessed, then do:
UResourceBundle bundle = UResourceBundle.getBundleInstance("de__PHONEBOOK");
ICUResourceBundle result = null;
if(bundle instanceof ICUResourceBundle){
result = ((ICUResourceBundle) bundle).getWithFallback("collations/default");
}
|
protected Enumeration<String> |
handleGetKeys()
Actual worker method for fetching the keys of resources contained in the resource.
|
int |
hashCode()
Returns an integer hash code for this object.
|
protected static UResourceBundle |
instantiateBundle(String baseName,
String localeID,
ClassLoader root,
boolean disableFallback) |
protected boolean |
isTopLevelResource()
Is this a top-level resource, that is, a whole bundle?
|
void |
setLoadingStatus(int newStatus)
This method is for setting the loading status of the resource.
|
void |
setLoadingStatus(String requestedLocale) |
protected void |
setParent(ResourceBundle parent)
Sets the parent resource bundle of this
ResourceBundle. |
void |
setTopLevelKeySet(Set<String> keySet)
Deprecated.
This API is ICU internal only.
|
addToCache, get, get, getBinary, getBinary, getBundleInstance, getBundleInstance, getBundleInstance, getBundleInstance, getBundleInstance, getBundleInstance, getBundleInstance, getBundleInstance, getInt, getIntVector, getIterator, getKeys, getSize, getString, getString, getStringArray, getType, getUInt, getVersion, handleGet, handleGet, handleGetObject, handleGetStringArray, handleKeySet, keySet, loadFromCache, resetBundleCacheclearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getObject, getString, getStringArray@Deprecated protected static final String ICU_DATA_PATH
@Deprecated public static final String ICU_BUNDLE
@Deprecated public static final String ICU_BASE_NAME
@Deprecated public static final String ICU_COLLATION_BASE_NAME
@Deprecated public static final String ICU_BRKITR_BASE_NAME
@Deprecated public static final String ICU_RBNF_BASE_NAME
@Deprecated public static final String ICU_TRANSLIT_BASE_NAME
@Deprecated public static final String ICU_LANG_BASE_NAME
@Deprecated public static final String ICU_CURR_BASE_NAME
@Deprecated public static final String ICU_REGION_BASE_NAME
@Deprecated public static final String ICU_ZONE_BASE_NAME
public static final ClassLoader ICU_DATA_CLASS_LOADER
protected static final String INSTALLED_LOCALES
public static final int FROM_FALLBACK
public static final int FROM_ROOT
public static final int FROM_DEFAULT
public static final int FROM_LOCALE
protected String key
public static final int RES_BOGUS
public static final int ALIAS
public static final int TABLE32
public static final int TABLE16
public static final int STRING_V2
public static final int ARRAY16
protected ICUResourceBundle(ICUResourceBundle.WholeBundle wholeBundle)
protected ICUResourceBundle(ICUResourceBundle container, String key)
public void setLoadingStatus(int newStatus)
UResourceBundlesetLoadingStatus in class UResourceBundlepublic int getLoadingStatus()
public void setLoadingStatus(String requestedLocale)
public static final ULocale getFunctionalEquivalent(String baseName, ClassLoader loader, String resName, String keyword, ULocale locID, boolean[] isAvailable, boolean omitDefault)
baseName - resource specifierresName - top level resource to consider (such as "collations")keyword - a particular keyword to consider (such as "collation" )locID - The requested localeisAvailable - If non-null, 1-element array of fillin parameter that indicates whether the
requested locale was available. The locale is defined as 'available' if it physically
exists within the specified tree and included in 'InstalledLocales'.omitDefault - if true, omit keyword and value if default.
'de_DE\@collation=standard' -> 'de_DE'public static final String[] getKeywordValues(String baseName, String keyword)
baseName - resource specifierkeyword - a particular keyword to consider, must match a top level resource name
within the tree. (i.e. "collations")public ICUResourceBundle getWithFallback(String path) throws MissingResourceException
UResourceBundle bundle = UResourceBundle.getBundleInstance("de__PHONEBOOK");
ICUResourceBundle result = null;
if(bundle instanceof ICUResourceBundle){
result = ((ICUResourceBundle) bundle).getWithFallback("collations/default");
}
path - The path to the required resource keyMissingResourceException - If a resource was not found.public ICUResourceBundle at(int index)
public ICUResourceBundle at(String key)
public ICUResourceBundle findTopLevel(int index)
UResourceBundlefindTopLevel in class UResourceBundleindex - the index of the resourceUResourceBundle.get(int)public ICUResourceBundle findTopLevel(String aKey)
UResourceBundlefindTopLevel in class UResourceBundleaKey - the key associated with the wanted resourceUResourceBundle.get(String)public ICUResourceBundle findWithFallback(String path)
path - the path to the resourcepublic String getStringWithFallback(String path) throws MissingResourceException
MissingResourceExceptionpublic void getAllArrayItemsWithFallback(String path, ICUResource.ArraySink sink) throws MissingResourceException
MissingResourceExceptionpublic void getAllTableItemsWithFallback(String path, ICUResource.TableSink sink) throws MissingResourceException
MissingResourceExceptionpublic static Set<String> getAvailableLocaleNameSet(String bundlePrefix, ClassLoader loader)
bundlePrefix - the prefix of the resource bundles to use.public static Set<String> getFullLocaleNameSet()
public static Set<String> getFullLocaleNameSet(String bundlePrefix, ClassLoader loader)
bundlePrefix - the prefix of the resource bundles to use.public static Set<String> getAvailableLocaleNameSet()
public static final ULocale[] getAvailableULocales(String baseName, ClassLoader loader)
public static final ULocale[] getAvailableULocales()
public static final Locale[] getAvailableLocales(String baseName, ClassLoader loader)
public static final Locale[] getAvailableLocales()
public static final Locale[] getLocaleList(ULocale[] ulocales)
ulocales - a list of ULocales to convert to a list of Locales.public Locale getLocale()
getLocale in class UResourceBundlepublic 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 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 static UResourceBundle getBundleInstance(String baseName, String localeID, ClassLoader root, boolean disableFallback)
protected static UResourceBundle instantiateBundle(String baseName, String localeID, ClassLoader root, boolean disableFallback)
public static UResourceBundle getBundleInstance(String baseName, ULocale locale, ICUResourceBundle.OpenType openType)
public static UResourceBundle getBundleInstance(String baseName, String localeID, ClassLoader root, ICUResourceBundle.OpenType openType)
public static ICUResourceBundle createBundle(String baseName, String localeID, ClassLoader root)
baseName - The name for the bundle.localeID - The locale identification.root - The ClassLoader object root.protected String getLocaleID()
UResourceBundlegetLocaleID in class UResourceBundleprotected String getBaseName()
UResourceBundlegetBaseName in class UResourceBundlepublic ULocale getULocale()
UResourceBundlegetULocale in class UResourceBundlepublic UResourceBundle getParent()
UResourceBundlegetParent in class UResourceBundleprotected void setParent(ResourceBundle parent)
ResourceBundleResourceBundle. The parent is
searched for resources which are not found in this ResourceBundle.setParent in class ResourceBundleparent - the parent ResourceBundle.public String getKey()
UResourceBundlegetKey in class UResourceBundleprotected static ICUResourceBundle getAliasedResource(ICUResourceBundle base, String[] keys, int depth, String key, int _resource, HashMap<String,String> aliasesVisited, UResourceBundle requested)
base - A direct or indirect container of the alias.keys - The key path to the alias, or null. (const)depth - The length of the key path, if keys != null.key - The alias' own key within this current container, if keys == null._resource - The alias resource int.aliasesVisited - Set of alias path strings already visited, for detecting loops.
We cannot change the type (e.g., to Setrequested - The original resource object from which the lookup started,
which is the starting point for "/LOCALE/..." aliases.public final Set<String> getTopLevelKeySet()
public final void setTopLevelKeySet(Set<String> keySet)
protected Enumeration<String> handleGetKeys()
UResourceBundlehandleGetKeys in class UResourceBundleprotected boolean isTopLevelResource()
UResourceBundleisTopLevelResource in class UResourceBundle