2.17.2: 2011-06-17

net.sf.basedb.util.resources
Class Utf8PropertiesResourceBundleControl

java.lang.Object
  extended by java.util.ResourceBundle.Control
      extended by net.sf.basedb.util.resources.Utf8PropertiesResourceBundleControl

public class Utf8PropertiesResourceBundleControl
extends ResourceBundle.Control

ResourceBundle.Control implementation that open property files in UTF-8 format instead of ISO-8859-1 format. Use INSTANCE as the control parameter when calling ResourceBundle.getBundle(String, java.util.ResourceBundle.Control).

Since:
2.16
Author:
Nicklas
Last modified
$Date: 2010-09-16 13:32:06 +0200 (Thu, 16 Sep 2010) $

Field Summary
static Utf8PropertiesResourceBundleControl INSTANCE
          The one and only instance.
 
Fields inherited from class java.util.ResourceBundle.Control
FORMAT_CLASS, FORMAT_DEFAULT, FORMAT_PROPERTIES, TTL_DONT_CACHE, TTL_NO_EXPIRATION_CONTROL
 
Constructor Summary
private Utf8PropertiesResourceBundleControl()
           
 
Method Summary
 Locale getFallbackLocale(String baseName, Locale locale)
          We don't need a fallback locale.
 List<String> getFormats(String baseName)
          This control only handle property files.
 ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)
          Load property files using UTF-8.
 
Methods inherited from class java.util.ResourceBundle.Control
getCandidateLocales, getControl, 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 Utf8PropertiesResourceBundleControl INSTANCE
The one and only instance.

Constructor Detail

Utf8PropertiesResourceBundleControl

private Utf8PropertiesResourceBundleControl()
Method Detail

getFallbackLocale

public Locale getFallbackLocale(String baseName,
                                Locale locale)
We don't need a fallback locale.

Overrides:
getFallbackLocale in class ResourceBundle.Control
Returns:
Always null

getFormats

public List<String> getFormats(String baseName)
This control only handle property files.

Overrides:
getFormats in class ResourceBundle.Control
Returns:
Always ResourceBundle.Control#FORMAT_PROPERTIES.

newBundle

public ResourceBundle newBundle(String baseName,
                                Locale locale,
                                String format,
                                ClassLoader loader,
                                boolean reload)
                         throws IllegalAccessException,
                                InstantiationException,
                                IOException
Load property files using UTF-8.

Overrides:
newBundle in class ResourceBundle.Control
Throws:
IllegalAccessException
InstantiationException
IOException

2.17.2: 2011-06-17