Skip to Content
Java in a Nutshell, 5th Edition
book

Java in a Nutshell, 5th Edition

by David Flanagan
March 2005
Intermediate to advanced
1254 pages
104h 21m
English
O'Reilly Media, Inc.
Content preview from Java in a Nutshell, 5th Edition

Name

ResourceBundle

Synopsis

This abstract class allows subclasses to define sets of localized resources that can then be dynamically loaded as needed by internationalized programs. Such resources may include user-visible text and images that appear in an application, as well as more complex things such as Menu objects. Use getBundle( ) to load a ResourceBundle subclass that is appropriate for the default or specified locale. Use getObject( ), getString( ), and getStringArray( ) to look up a named resource in a bundle. To define a bundle, provide implementations of handleGetObject( ) and getKeys( ). It is often easier, however, to subclass ListResourceBundle or provide a Properties file that is used by PropertyResourceBundle. The name of any localized ResourceBundle class you define should include the locale language code, and, optionally, the locale country code.

public abstract class ResourceBundle {
// Public Constructors
     public ResourceBundle( );  
// Public Class Methods
     public static final ResourceBundle getBundle(String baseName);  
     public static final ResourceBundle getBundle(String baseName, Locale locale);  
1.2  public static ResourceBundle getBundle(String baseName, Locale locale, ClassLoader loader);  
// Public Instance Methods
     public abstract Enumeration<String> getKeys( );  
1.2  public Locale getLocale( );  
     public final Object getObject(String key);  
     public final String getString(String key);  
     public final String[ ] getStringArray(String key);  
// Protected Instance Methods protected ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java in a Nutshell, 8th Edition

Java in a Nutshell, 8th Edition

Benjamin J. Evans, Jason Clark, David Flanagan
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan
Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
Learning Java, 4th Edition

Learning Java, 4th Edition

Patrick Niemeyer, Daniel Leuck

Publisher Resources

ISBN: 0596007736Supplemental ContentErrata Page