|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.ResourceBundle
com.ibm.icu.util.UResourceBundle
A class representing a collection of resource information pertaining to a given locale. A resource bundle provides a way of accessing locale- specfic information in a data file. You create a resource bundle that manages the resources for a given locale and then ask it for individual resources.
In ResourceBundle class, an object is created and the sub items are fetched using getString, getObject methods. In UResourceBundle,each individual element of a resource is a resource by itself.
Resource bundles in ICU are currently defined using text files which conform to the following BNF definition. More on resource bundle concepts and syntax can be found in the Users Guide.
The packaging of ICU *.res files can be of two types
ICU4C:
root.res
|
--------
| |
fr.res en.res
|
--------
| |
fr_CA.res fr_FR.res
JAVA/JDK:
LocaleElements.res
|
-------------------
| |
LocaleElements_fr.res LocaleElements_en.res
|
---------------------------
| |
LocaleElements_fr_CA.res LocaleElements_fr_FR.res
Depending on the organization of your resources, the syntax to getBundleInstance will change.
To open ICU style organization use:
UResourceBundle bundle = UResourceBundle.getBundleInstance("com/ibm/icu/impl/data/icudt30b", "en_US");
To open Java/JDK style organization use:
UResourceBundle bundle = UResourceBundle.getBundleInstance("com.ibm.icu.impl.data.LocaleElements", "en_US");
Field Summary |
Fields inherited from class java.util.ResourceBundle |
parent |
Constructor Summary | |
protected |
UResourceBundle()
Deprecated. This is a draft API and might change in a future release of ICU. |
Method Summary | |
protected abstract String |
getBaseName()
Deprecated. This is a draft API and might change in a future release of ICU. |
static UResourceBundle |
getBundleInstance(String baseName)
Deprecated. This is a draft API and might change in a future release of ICU. |
static UResourceBundle |
getBundleInstance(String baseName,
Locale locale)
Deprecated. This is a draft API and might change in a future release of ICU. |
static UResourceBundle |
getBundleInstance(String baseName,
String localeName)
Deprecated. This is a draft API and might change in a future release of ICU. |
static UResourceBundle |
getBundleInstance(String baseName,
String localeName,
ClassLoader root)
Deprecated. This is a draft API and might change in a future release of ICU. |
protected static UResourceBundle |
getBundleInstance(String baseName,
String localeName,
ClassLoader root,
boolean disableFallback)
Deprecated. This is a draft API and might change in a future release of ICU. |
static UResourceBundle |
getBundleInstance(String baseName,
ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU. |
static UResourceBundle |
getBundleInstance(ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU. |
Locale |
getLocale()
Deprecated. This is a draft API and might change in a future release of ICU. |
protected abstract String |
getLocaleID()
Deprecated. This is a draft API and might change in a future release of ICU. |
protected abstract UResourceBundle |
getParent()
Deprecated. This is a draft API and might change in a future release of ICU. |
abstract ULocale |
getULocale()
Deprecated. This is a draft API and might change in a future release of ICU. |
protected static UResourceBundle |
instantiateBundle(String baseName,
String localeName,
ClassLoader root,
boolean disableFallback)
Deprecated. This is a draft API and might change in a future release of ICU. |
protected static UResourceBundle |
instantiateICUResource(String baseName,
String localeID,
ClassLoader root)
Deprecated. This is a draft API and might change in a future release of ICU. |
protected abstract void |
setLoadingStatus(int newStatus)
Deprecated. |
Methods inherited from class java.util.ResourceBundle |
getBundle, getBundle, getBundle, getKeys, getObject, getString, getStringArray, handleGetObject, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected UResourceBundle()
Method Detail |
public static final UResourceBundle getBundleInstance(String baseName, String localeName)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desired
MissingResourceException
- if no resource bundle for the specified base name can be foundpublic static final UResourceBundle getBundleInstance(String baseName, String localeName, ClassLoader root)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desiredroot
- the class object from which to load the resource bundle
MissingResourceException
- if no resource bundle for the specified base name can be foundprotected static UResourceBundle getBundleInstance(String baseName, String localeName, ClassLoader root, boolean disableFallback)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desiredroot
- the class object from which to load the resource bundledisableFallback
- Option to disable locale inheritence.
If true the fallback chain will not be built.
MissingResourceException
- if no resource bundle for the specified base name can be foundpublic static final UResourceBundle getBundleInstance(ULocale locale)
locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public static final UResourceBundle getBundleInstance(String baseName)
baseName
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public static final UResourceBundle getBundleInstance(String baseName, Locale locale)
baseName
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public static final UResourceBundle getBundleInstance(String baseName, ULocale locale)
baseName
- string containing the name of the data package.
If null the default ICU package name is used.locale
- specifies the locale for which we want to open the resource.
If null the bundle for default locale is opened.
public abstract ULocale getULocale()
protected abstract String getLocaleID()
protected abstract String getBaseName()
protected abstract UResourceBundle getParent()
public Locale getLocale()
protected static UResourceBundle instantiateBundle(String baseName, String localeName, ClassLoader root, boolean disableFallback)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleName
- the locale for which a resource bundle is desiredroot
- the class object from which to load the resource bundledisableFallback
- disables loading of fallback lookup chain
MissingResourceException
- if no resource bundle for the specified base name can be foundprotected abstract void setLoadingStatus(int newStatus)
protected static UResourceBundle instantiateICUResource(String baseName, String localeID, ClassLoader root)
baseName
- the base name of the resource bundle, a fully qualified class namelocaleID
- the locale for which a resource bundle is desiredroot
- the class object from which to load the resource bundle
MissingResourceException
- if no resource bundle for the specified base name can be found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |