org.ka2ddo.util
Class UTF8ResourceControl

java.lang.Object
  extended by java.util.ResourceBundle.Control
      extended by org.ka2ddo.util.UTF8ResourceControl

public class UTF8ResourceControl
extends java.util.ResourceBundle.Control

This Control loads PropertyResourceBundles using a UTF-8 locale Reader to read the properties file.


Field Summary
static UTF8ResourceControl INSTANCE
           
 
Fields inherited from class java.util.ResourceBundle.Control
FORMAT_CLASS, FORMAT_DEFAULT, FORMAT_PROPERTIES, TTL_DONT_CACHE, TTL_NO_EXPIRATION_CONTROL
 
Method Summary
 java.util.List<java.lang.String> getFormats(java.lang.String baseName)
          Returns a List of Strings containing formats to be used to load resource bundles for the given baseName.
 java.util.ResourceBundle newBundle(java.lang.String baseName, java.util.Locale locale, java.lang.String format, java.lang.ClassLoader loader, boolean reload)
          Instantiates a resource bundle for the given bundle name of the given format and locale, using the given class loader if necessary.
 
Methods inherited from class java.util.ResourceBundle.Control
getCandidateLocales, getControl, getFallbackLocale, getNoFallbackControl, getTimeToLive, needsReload, toBundleName, toResourceName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final UTF8ResourceControl INSTANCE
Method Detail

getFormats

public java.util.List<java.lang.String> getFormats(java.lang.String baseName)
Returns a List of Strings containing formats to be used to load resource bundles for the given baseName. The ResourceBundle.getBundle factory method tries to load resource bundles with formats in the order specified by the list. The list returned by this method must have at least one String. The predefined formats are "java.class" for class-based resource bundles and "java.properties" for properties-based ones. Strings starting with "java." are reserved for future extensions and must not be used by application-defined formats.

Overrides:
getFormats in class java.util.ResourceBundle.Control
Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
Returns:
a List of Strings containing formats for loading resource bundles.
Throws:
java.lang.NullPointerException - if baseName is null
See Also:
ResourceBundle.Control.FORMAT_PROPERTIES

newBundle

public java.util.ResourceBundle newBundle(java.lang.String baseName,
                                          java.util.Locale locale,
                                          java.lang.String format,
                                          java.lang.ClassLoader loader,
                                          boolean reload)
                                   throws java.lang.IllegalAccessException,
                                          java.lang.InstantiationException,
                                          java.io.IOException
Instantiates a resource bundle for the given bundle name of the given format and locale, using the given class loader if necessary. This method returns null if there is no resource bundle available for the given parameters. If a resource bundle can't be instantiated due to an unexpected error, the error must be reported by throwing an Error or Exception rather than simply returning null.

If the reload flag is true, it indicates that this method is being called because the previously loaded resource bundle has expired.

This implementation instantiates a ResourceBundle as follows.

Overrides:
newBundle in class java.util.ResourceBundle.Control
Parameters:
baseName - the base bundle name of the resource bundle, a fully qualified class name
locale - the locale for which the resource bundle should be instantiated
format - the resource bundle format to be loaded
loader - the ClassLoader to use to load the bundle
reload - the flag to indicate bundle reloading; true if reloading an expired resource bundle, false otherwise
Returns:
the resource bundle instance, or null if none could be found.
Throws:
java.lang.NullPointerException - if bundleName, locale, format, or loader is null, or if null is returned by toBundleName
java.lang.IllegalArgumentException - if format is unknown, or if the resource found for the given parameters contains malformed data.
java.lang.ClassCastException - if the loaded class cannot be cast to ResourceBundle
java.lang.IllegalAccessException - if the class or its nullarg constructor is not accessible.
java.lang.InstantiationException - if the instantiation of a class fails for some other reason.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
java.lang.SecurityException - If a security manager is present and creation of new instances is denied. See Class.newInstance() for details.
java.io.IOException - if an error occurred when reading resources using any I/O operations