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

public Class ICUResourceBundle

extends UResourceBundle
Class Inheritance
Known Direct Subclasses
com.ibm.icu.impl.ICUResourceBundleImpl
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, java.net.URL, java.util.ArrayList, .Collections, .Comparator, .EnumMap, .Enumeration, .HashMap, .HashSet, .Iterator, .Locale, .MissingResourceException, .ResourceBundle, .Set, com.ibm.icu.impl.ICUResourceBundleReader.ReaderValue, .URLHandler.URLVisitor, com.ibm.icu.util.ULocale, .UResourceBundle, .UResourceBundleIterator, .UResourceTypeMismatchException

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
ICUResourceBundle.AvailEntry

Holds the prefix, and lazily creates the Locale[] list or the locale name Set as needed.

private abstract static class
ICUResourceBundle.Loader

Loader for bundle instances, for caching.

public static enum
protected static class
ICUResourceBundle.WholeBundle

Fields for a whole bundle, rather than any specific resource in the bundle.

Field Summary

Modifier and TypeField and Description
public static final 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).

public static final int
ARRAY16

Resource type constant for arrays with 16-bit count and values.

private static CacheBase<String, ICUResourceBundle, ICUResourceBundle.Loader>
private static final Comparator<String[]>
private ICUResourceBundle
private static final boolean
private static final String
private static final String
private static CacheBase<String, ICUResourceBundle.AvailEntry, ClassLoader>
private static final char
public static final ClassLoader
ICU_DATA_CLASS_LOADER

The class loader constant to be used with getBundleInstance API

private static final String
private static final String
protected static final String
INSTALLED_LOCALES

The name of the resource containing the installed locales

protected String
key

Data member where the subclasses store the key.

private static final String
public static final String
NO_INHERITANCE_MARKER

CLDR string value "∅∅∅" prevents fallback to the parent bundle.

public static final int
RES_BOGUS

A resource word value that means "no resource".

private static final char
private static final String
public static final int
STRING_V2

Resource type constant for 16-bit Unicode strings in formatVersion 2.

public static final int
TABLE16

Resource type constant for tables with 16-bit count, key offsets and values.

public static final int
TABLE32

Resource type constant for tables with 32-bit count, key offsets and values.

pack-priv ICUResourceBundle.WholeBundle
Inherited from com.ibm.icu.util.UResourceBundle:
ARRAYBINARYINTINT_VECTORNONESTRINGTABLE

Constructor Summary

AccessConstructor and Description
protected
ICUResourceBundle(ICUResourceBundle.WholeBundle wholeBundle)

Constructor for the root table of a bundle.

protected

Method Summary

Modifier and TypeMethod and Description
private static final void
addBundleBaseNamesFromClassLoader(final String bn, final ClassLoader root, final Set<String> names)

private static final void
private static void
public ICUResourceBundle
at(int index)

public ICUResourceBundle
at(String key)

private static int
public static ICUResourceBundle

Returns:

the new bundle
createBundle
(String
The name for the bundle.
baseName
,
String
The locale identification.
localeID
,
ClassLoader
The ClassLoader object root.
root
)

Create a bundle using a reader.

private static Set<String>
private static Set<String>
private static final EnumMap<ULocale.AvailableType, ULocale[]>
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.
private static final ICUResourceBundle
private static final ICUResourceBundle
public String
private static final String
findStringWithFallback(String path, UResourceBundle actualBundle, UResourceBundle requested)

Like findResourceWithFallback(...).getString() but with minimal creation of intermediate ICUResourceBundle objects.

public ICUResourceBundle
findTopLevel(int
the index of the resource
index
)

Overrides com.ibm.icu.util.UResourceBundle.findTopLevel.

Returns a resource in a given resource that has a given index, or null if the resource is not found.
public ICUResourceBundle
findTopLevel(String
the key associated with the wanted resource
aKey
)

Overrides com.ibm.icu.util.UResourceBundle.findTopLevel.

Returns a resource in a given resource that has a given key, or null if the resource is not found.
public ICUResourceBundle

Returns:

the resource, or null
findWithFallback
(String
the path to the resource
path
)

Like getWithFallback, but returns null if the resource is not found instead of throwing an exception.

pack-priv ICUResourceBundle
get(String aKey, HashMap<String, String> aliasesVisited, UResourceBundle requested)

protected static ICUResourceBundle

Returns:

the aliased resource object
getAliasedResource
(ICUResourceBundle
A direct or indirect container of the alias.
base
,
String[]
The key path to the alias, or null. (const)
keys
,
int
The length of the key path, if keys != null.
depth
,
String
The alias' own key within this current container, if keys == null.
key
,
int
The alias resource int.
_resource
,
HashMap<String, String>
Set of alias path strings already visited, for detecting loops. We cannot change the type (e.g., to Set) because it is used in protected/@stable UResourceBundle methods.
aliasesVisited
,
UResourceBundle
The original resource object from which the lookup started, which is the starting point for "/LOCALE/..." aliases.
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)

public void
getAllChildrenWithFallback(final String
The path of the desired resource
path
,
final UResource.Sink
A UResource.Sink that gets called for each child resource of the specified resource (and each child of the resources in its parent chain).
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).

public void
getAllItemsWithFallback(String
The path of the desired resource
path
,
UResource.Sink
A UResource.Sink that gets called for each resource in the parent chain
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.

private void
public void
public static Set<String>
getAvailableLocaleNameSet(String
the prefix of the resource bundles to use.
bundlePrefix
,
ClassLoader loader)

Return a set of the locale names supported by a collection of resource bundles.

public static Set<String>
getAvailableLocaleNameSet()

Return a set of the locale names supported by a collection of resource bundles.

public static final Locale[]

Returns:

the list of available locales
getAvailableLocales
(String baseName, ClassLoader loader, ULocale.AvailableType type)

Get the set of Locales installed in the specified bundles, for the specified type.

public static final Locale[]

Returns:

the list of available locales
getAvailableLocales
()

Get the set of ULocales installed the base bundle.

public static final Locale[]

Returns:

the list of available locales
getAvailableLocales
(ULocale.AvailableType type)

Get the set of Locales installed the base bundle, for the specified type.

public static final Locale[]

Returns:

the list of available locales
getAvailableLocales
(String baseName, ClassLoader loader)

Get the set of Locales installed in the specified bundles.

public static final ULocale[]

Returns:

the list of available locales
getAvailableULocales
(String baseName, ClassLoader loader, ULocale.AvailableType type)

Get the set of Locales installed in the specified bundles, for the specified type.

public static final ULocale[]

Returns:

the list of available locales
getAvailableULocales
()

Get the set of ULocales installed the base bundle.

public static final ULocale[]

Returns:

the list of available locales for the specified type
getAvailableULocales
(ULocale.AvailableType type)

Get the set of ULocales installed the base bundle, for the specified type.

public static final ULocale[]

Returns:

the list of available locales
getAvailableULocales
(String baseName, ClassLoader loader)

Get the set of Locales installed in the specified bundles.

private static ICUResourceBundle.AvailEntry
getAvailEntry(String key, ClassLoader loader)

Stores the locale information in a cache accessed by key (bundle prefix).

protected String
private static ICUResourceBundle
getBundle(ICUResourceBundleReader reader, String baseName, String localeID, ClassLoader loader)

public static ICUResourceBundle
getBundleInstance(String
string containing the name of the data package. If null the default ICU package name is used.
baseName
,
String
the locale for which a resource bundle is desired
localeID
,
ClassLoader
the class object from which to load the resource bundle
root
,
boolean
Option to disable locale inheritance. If true the fallback chain will not be built.
disableFallback
)

Hides com.ibm.icu.util.UResourceBundle.getBundleInstance.

ICU

public static ICUResourceBundle
public static ICUResourceBundle
private static String
getDefaultScript(String language, String region)

private static String
public static Set<String>
getFullLocaleNameSet()

Return a set of all the locale names supported by a collection of resource bundles.

public static Set<String>
getFullLocaleNameSet(String
the prefix of the resource bundles to use.
bundlePrefix
,
ClassLoader loader)

Return a set of all the locale names supported by a collection of resource bundles.

public static final ULocale

Returns:

the locale
getFunctionalEquivalent
(String
resource specifier
baseName
,
ClassLoader loader, String
top level resource to consider (such as "collations")
resName
,
String
a particular keyword to consider (such as "collation" )
keyword
,
ULocale
The requested locale
locID
,
boolean[]
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'.
isAvailable
,
boolean
if true, omit keyword and value if default. 'de_DE\@collation=standard' -> 'de_DE'
omitDefault
)

Returns a functionally equivalent locale, considering keywords as well, for the specified keyword.

public String
public static final String[]
getKeywordValues(String
resource specifier
baseName
,
String
a particular keyword to consider, must match a top level resource name within the tree. (i.e. "collations")
keyword
)

Given a tree path and keyword, return a string enumeration of all possible values for that keyword.

public Locale

Returns:

the locale of this resource bundle
getLocale
()

Overrides com.ibm.icu.util.UResourceBundle.getLocale.

Returns the locale of this resource bundle.
protected String
public static final Locale[]

Returns:

the list of converted ULocales
getLocaleList
(ULocale[]
a list of ULocales to convert to a list of Locales.
ulocales
)

Convert a list of ULocales to a list of Locales.

private boolean

Returns:

The noFallback flag.
getNoFallback
()

Get the noFallback flag specified in the loaded bundle.

public ICUResourceBundle
public static String
private int
private void
getResPathKeys(String[] keys, int depth)

Fills some of the keys array with the keys on the path to this resource object.

private static void
getResPathKeys(String
path string
path
,
int num, String[] keys, int
index where the first path key is stored
start
)

Fills some of the keys array (from start) with the num keys from the path string.

public String
public final Set<String>
getTopLevelKeySet()

Deprecated This API is ICU internal only.
public ULocale
public UResource.Value
public ICUResourceBundle

Returns:

resource represented by the key
getWithFallback
(String
The path to the required resource key
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>
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
private static ICUResourceBundle
instantiateBundle(final String baseName, final String localeID, final String origLocaleID, final String defaultID, final ClassLoader root, final ICUResourceBundle.OpenType openType)

public boolean
isRoot()

Returns true if this is the root bundle, or an item in the root bundle.

protected boolean
isTopLevelResource()

Overrides com.ibm.icu.util.UResourceBundle.isTopLevelResource.

Is this a top-level resource, that is, a whole bundle?
private static boolean
protected void
setParent(ResourceBundle
this bundle's parent bundle.
parent
)

Overrides java.util.ResourceBundle.setParent.

Sets the parent bundle of this bundle.
public final void
setTopLevelKeySet(Set<String> keySet)

Deprecated This API is ICU internal only.
Inherited from com.ibm.icu.util.UResourceBundle:
getgetgetBinarygetBinarygetBundleInstancegetBundleInstancegetBundleInstancegetBundleInstancegetBundleInstancegetBundleInstancegetBundleInstancegetBundleInstancegetIntgetIntVectorgetIteratorgetKeysgetSizegetStringgetStringgetStringArraygetTypegetUIntgetVersionhandleGethandleGethandleGetObjecthandleGetStringArrayhandleKeySetinstantiateBundlekeySet