Java.util.ResourceBundle Class

Advertisements


Introduction

The java.util.ResourceBundle class contain locale-specific objects.Following are the important points about ResourceBundle:

  • The class allows you to write programs that can be easily localized, or translated, into different languages.

  • This class programs handle multiple locales at once be easily modified later to support even more locales.

  • The Java Platform provides two subclasses of ResourceBundle, ListResourceBundle and PropertyResourceBundle.

Class declaration

Following is the declaration for java.util.ResourceBundle class:

public abstract class ResourceBundle
   extends Object

Field

Following are the fields for java.util.ResourceBundle class:

  • protected ResourceBundle parent -- This is the parent bundle of this bundle.

Class constructors

S.N.Constructor & Description
1ResourceBundle()
This is the single constructor.

Class methods

S.N.Method & Description
1static void clearCache()
This method removes all resource bundles from the cache that have been loaded using the caller's class loader.
2static void clearCache(ClassLoader loader)
This method removes all resource bundles from the cache that have been loaded using the given class loader.
3 boolean containsKey(String key)
This method determines whether the given key is contained in this ResourceBundle or its parent bundles.
4 static ResourceBundle getBundle(String baseName)
This method gets a resource bundle using the specified base name, the default locale, and the caller's class loader.
5 static ResourceBundle getBundle(String baseName, Locale locale)
This method gets a resource bundle using the specified base name and locale, and the caller's class loader.
6static ResourceBundle getBundle(String baseName, Locale locale, ClassLoader loader)
This method gets a resource bundle using the specified base name, locale, and class loader.
7 static ResourceBundle getBundle(String baseName, Locale targetLocale, ClassLoader loader, ResourceBundle.Control control)
This method Returns a resource bundle using the specified base name, target locale, class loader and control.
8 static ResourceBundle getBundle(String baseName, Locale targetLocale, ResourceBundle.Control control)
This method returns a resource bundle using the specified base name, target locale and control, and the caller's class loader.
9 static ResourceBundle getBundle(String baseName, ResourceBundle.Control control)
This method returns a resource bundle using the specified base name, the default locale and the specified control.
10 abstract Enumeration<String> getKeys()
This method returns an enumeration of the keys.
11 Locale getLocale()
This method returns the locale of this resource bundle.
12 Object getObject(String key)
This method gets an object for the given key from this resource bundle or one of its parents.
13 String getString(String key)
This method gets a string for the given key from this resource bundle or one of its parents.
14 String[] getStringArray(String key)
This method gets a string array for the given key from this resource bundle or one of its parents.
15 protected abstract Object handleGetObject(String key)
This method gets an object for the given key from this resource bundle.
16 protected Set<String> handleKeySet()
This method queries if the given date is in daylight savings time in this time zone.
17 Set<String> keySet()
This method returns a Set of all keys contained in this ResourceBundle and its parent bundles.
18 protected void setParent(ResourceBundle parent)
This method sets the parent bundle of this bundle.

Methods inherited

This class inherits methods from the following classes:

  • java.util.Object




Advertisements
Advertisements