com.ibm.icu.util
Class UResourceBundle

java.lang.Object
  extended byjava.util.ResourceBundle
      extended bycom.ibm.icu.util.UResourceBundle

Deprecated. This is a draft API and might change in a future release of ICU.

public abstract class UResourceBundle
extends ResourceBundle

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");

Author:
ram
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

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

UResourceBundle

protected UResourceBundle()
Deprecated. This is a draft API and might change in a future release of ICU.

Sole constructor. (For invocation by subclass constructors, typically implicit.)

Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..
Method Detail

getBundleInstance

public static final UResourceBundle getBundleInstance(String baseName,
                                                      String localeName)
Deprecated. This is a draft API and might change in a future release of ICU.

Creates a resource bundle using the specified base name and locale. ICU_DATA_CLASS is used as the default root.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
localeName - the locale for which a resource bundle is desired
Returns:
a resource bundle for the given base name and locale
Throws:
MissingResourceException - if no resource bundle for the specified base name can be found
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getBundleInstance

public static final UResourceBundle getBundleInstance(String baseName,
                                                      String localeName,
                                                      ClassLoader root)
Deprecated. This is a draft API and might change in a future release of ICU.

Creates a resource bundle using the specified base name, locale, and class root.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
localeName - the locale for which a resource bundle is desired
root - the class object from which to load the resource bundle
Returns:
a resource bundle for the given base name and locale
Throws:
MissingResourceException - if no resource bundle for the specified base name can be found
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getBundleInstance

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.

Creates a resource bundle using the specified base name, locale, and class root.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
localeName - the locale for which a resource bundle is desired
root - the class object from which to load the resource bundle
disableFallback - Option to disable locale inheritence. If true the fallback chain will not be built.
Returns:
a resource bundle for the given base name and locale
Throws:
MissingResourceException - if no resource bundle for the specified base name can be found
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getBundleInstance

public static final UResourceBundle getBundleInstance(ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU.

Creates a UResourceBundle for the locale specified, from which users can extract resources by using their corresponding keys.

Parameters:
locale - specifies the locale for which we want to open the resource. If null the bundle for default locale is opened.
Returns:
a resource bundle for the given locale
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getBundleInstance

public static final UResourceBundle getBundleInstance(String baseName)
Deprecated. This is a draft API and might change in a future release of ICU.

Creates a UResourceBundle for the default locale and specified base name, from which users can extract resources by using their corresponding keys.

Parameters:
baseName - specifies the locale for which we want to open the resource. If null the bundle for default locale is opened.
Returns:
a resource bundle for the given base name and default locale
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getBundleInstance

public static final UResourceBundle getBundleInstance(String baseName,
                                                      Locale locale)
Deprecated. This is a draft API and might change in a future release of ICU.

Creates a UResourceBundle for the specified locale and specified base name, from which users can extract resources by using their corresponding keys.

Parameters:
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.
Returns:
a resource bundle for the given base name and locale
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getBundleInstance

public static final UResourceBundle getBundleInstance(String baseName,
                                                      ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU.

Creates a UResourceBundle, from which users can extract resources by using their corresponding keys.

Parameters:
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.
Returns:
a resource bundle for the given base name and locale
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getULocale

public abstract ULocale getULocale()
Deprecated. This is a draft API and might change in a future release of ICU.

Returns the RFC 3066 conformant locale id of this resource bundle. This method can be used after a call to getBundleInstance() to determine whether the resource bundle returned really corresponds to the requested locale or is a fallback.

Returns:
the locale of this resource bundle
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getLocaleID

protected abstract String getLocaleID()
Deprecated. This is a draft API and might change in a future release of ICU.

Gets the localeID

Returns:
The string representation of the localeID
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getBaseName

protected abstract String getBaseName()
Deprecated. This is a draft API and might change in a future release of ICU.

Gets the base name of the resource bundle

Returns:
The string representation of the base name
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getParent

protected abstract UResourceBundle getParent()
Deprecated. This is a draft API and might change in a future release of ICU.

Gets the parent bundle

Returns:
The parent bundle
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

getLocale

public Locale getLocale()
Deprecated. This is a draft API and might change in a future release of ICU.

Get the locale of this bundle

Returns:
the locale of this resource bundle
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

instantiateBundle

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.

Loads a new resource bundle for the give base name, locale and class loader. Optionally will disable loading of fallback bundles.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
localeName - the locale for which a resource bundle is desired
root - the class object from which to load the resource bundle
disableFallback - disables loading of fallback lookup chain
Returns:
a resource bundle for the given base name and locale
Throws:
MissingResourceException - if no resource bundle for the specified base name can be found
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..

setLoadingStatus

protected abstract void setLoadingStatus(int newStatus)
Deprecated. 
Status:
Internal. This API is Internal Only and can change at any time.

instantiateICUResource

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.

Creates a new ICUResourceBundle for the given locale, baseName and class loader

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
localeID - the locale for which a resource bundle is desired
root - the class object from which to load the resource bundle
Returns:
a resource bundle for the given base name and locale
Throws:
MissingResourceException - if no resource bundle for the specified base name can be found
Status:
Draft ICU 3.0.
Status:
Deprecated in This is a draft API and might change in a future release of ICU..


Copyright (c) 2004 IBM Corporation and others.