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 ClassLoader |
ICU_DATA_CLASS_LOADER
The class loader constant to be used with getBundleInstance API
|
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 String |
NO_INHERITANCE_MARKER
CLDR string value "∅∅∅" prevents fallback to the parent bundle.
|
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) |
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.
|
protected static ICUResourceBundle |
getAliasedResource(String rpath,
ClassLoader loaderToUse,
String baseName,
String[] keys,
int depth,
String[] baseKeyPath,
HashMap<String,String> aliasesVisited,
UResourceBundle requested) |
void |
getAllChildrenWithFallback(String path,
UResource.Sink sink)
Locates the resource specified by `path` in this resource bundle (performing any necessary fallback and
following any aliases) and, if the resource is a table resource, iterates over its immediate child resources (again,
following any aliases to get the individual resource values), and calls the specified `sink`'s `put()` method
for each child resource (passing it that resource's key and either its actual value or, if that value is an
alias, the value you get by following the alias).
|
void |
getAllItemsWithFallback(String path,
UResource.Sink sink)
Locates the resource specified by `path` in this resource bundle (performing any necessary fallback and
following any aliases) and calls the specified `sink`'s `put()` method with that resource.
|
void |
getAllItemsWithFallbackNoFail(String path,
UResource.Sink 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 ULocales installed the base bundle.
|
static Locale[] |
getAvailableLocales(String baseName,
ClassLoader loader)
Get the set of Locales installed in the specified bundles.
|
static Locale[] |
getAvailableLocales(String baseName,
ClassLoader loader,
ULocale.AvailableType type)
Get the set of Locales installed in the specified bundles, for the specified type.
|
static Locale[] |
getAvailableLocales(ULocale.AvailableType type)
Get the set of Locales installed the base bundle, for the specified type.
|
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.
|
static ULocale[] |
getAvailableULocales(String baseName,
ClassLoader loader,
ULocale.AvailableType type)
Get the set of Locales installed in the specified bundles, for the specified type.
|
static ULocale[] |
getAvailableULocales(ULocale.AvailableType type)
Get the set of ULocales installed the base bundle, for the specified type.
|
protected String |
getBaseName()
Returns the base name of the resource bundle
|
static ICUResourceBundle |
getBundleInstance(String baseName,
String localeID,
ClassLoader root,
boolean disableFallback) |
static ICUResourceBundle |
getBundleInstance(String baseName,
String localeID,
ClassLoader root,
ICUResourceBundle.OpenType openType) |
static ICUResourceBundle |
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.
|
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.
|
ICUResourceBundle |
getParent()
Returns the parent bundle
|
String |
getStringWithFallback(String path) |
ULocale |
getULocale()
Returns the RFC 3066 conformant locale id of this resource bundle.
|
UResource.Value |
getValueWithFallback(String path) |
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() |
boolean |
isRoot()
Returns true if this is the root bundle, or an item in the root bundle.
|
protected boolean |
isTopLevelResource()
Is this a top-level resource, that is, a whole bundle?
|
protected void |
setParent(ResourceBundle parent) |
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, instantiateBundleclearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getObject, getString, getStringArray, handleKeySet, keySetpublic static final String NO_INHERITANCE_MARKER
public static final ClassLoader ICU_DATA_CLASS_LOADER
protected static final String INSTALLED_LOCALES
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 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 UResource.Value getValueWithFallback(String path) throws MissingResourceException
MissingResourceExceptionpublic void getAllItemsWithFallbackNoFail(String path, UResource.Sink sink)
public void getAllItemsWithFallback(String path, UResource.Sink sink) throws MissingResourceException
path - The path of the desired resourcesink - A `UResource.Sink` that gets called for each resource in the parent chainMissingResourceExceptionpublic void getAllChildrenWithFallback(String path, UResource.Sink sink) throws MissingResourceException
path - The path of the desired resourcesink - A `UResource.Sink` that gets called for each child resource of the specified resource (and each child
of the resources in its parent chain).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, ULocale.AvailableType type)
public static final ULocale[] getAvailableULocales()
public static final ULocale[] getAvailableULocales(ULocale.AvailableType type)
public static final ULocale[] getAvailableULocales(String baseName, ClassLoader loader)
public static final Locale[] getAvailableLocales(String baseName, ClassLoader loader, ULocale.AvailableType type)
public static final Locale[] getAvailableLocales()
public static final Locale[] getAvailableLocales(ULocale.AvailableType type)
public static final Locale[] getAvailableLocales(String baseName, ClassLoader loader)
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 static ICUResourceBundle getBundleInstance(String baseName, String localeID, ClassLoader root, boolean disableFallback)
public static ICUResourceBundle getBundleInstance(String baseName, ULocale locale, ICUResourceBundle.OpenType openType)
public static ICUResourceBundle 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 boolean isRoot()
public ICUResourceBundle getParent()
UResourceBundlegetParent in class UResourceBundleprotected void setParent(ResourceBundle parent)
setParent in class ResourceBundlepublic 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.protected static ICUResourceBundle getAliasedResource(String rpath, ClassLoader loaderToUse, String baseName, String[] keys, int depth, String[] baseKeyPath, HashMap<String,String> aliasesVisited, UResourceBundle requested)
protected Enumeration<String> handleGetKeys()
UResourceBundlehandleGetKeys in class UResourceBundleprotected boolean isTopLevelResource()
UResourceBundleisTopLevelResource in class UResourceBundle