Package org.jfree.chart.util
Class ResourceBundleWrapper
java.lang.Object
org.jfree.chart.util.ResourceBundleWrapper
Wrapper of ResourceBundle.getBundle() methods. This wrapper is introduced to
avoid a dramatic performance penalty by superfluous resource (and classes
loaded by Class.forName) lookups on web server in applets.
public class AppletC extends javax.swing.JApplet { public void init() { ResourceBundleWrapper.removeCodeBase(getCodeBase(), (URLClassLoader) getClass().getClassLoader()); ...
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static URLClassLoader
A special class loader with no code base lookup. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceBundle
Finds and returns the specified resource bundle.static ResourceBundle
Finds and returns the specified resource bundle.static ResourceBundle
getBundle
(String baseName, Locale locale, ClassLoader loader) Maps directly toResourceBundle.getBundle(baseName, locale, loader)
.static void
removeCodeBase
(URL codeBase, URLClassLoader urlClassLoader) Instantiate aURLClassLoader
for resource lookups where the codeBase URL is removed.
-
Field Details
-
noCodeBaseClassLoader
A special class loader with no code base lookup. This field may benull
(the field is only initialised if removeCodeBase() is called from an applet).
-
-
Constructor Details
-
ResourceBundleWrapper
private ResourceBundleWrapper()Private constructor.
-
-
Method Details
-
removeCodeBase
Instantiate aURLClassLoader
for resource lookups where the codeBase URL is removed. This method is typically called from an applet's init() method. If this method is never called, thegetBundle()
methods map to the standardResourceBundle
lookup methods.- Parameters:
codeBase
- the codeBase URL.urlClassLoader
- the class loader.
-
getBundle
Finds and returns the specified resource bundle.- Parameters:
baseName
- the base name.- Returns:
- The resource bundle.
-
getBundle
Finds and returns the specified resource bundle.- Parameters:
baseName
- the base name.locale
- the locale.- Returns:
- The resource bundle.
-
getBundle
Maps directly toResourceBundle.getBundle(baseName, locale, loader)
.- Parameters:
baseName
- the base name.locale
- the locale.loader
- the class loader.- Returns:
- The resource bundle.
-