Holger's
Java API

com.antelmann.util
Class FormattedResourceBundle

java.lang.Object
  extended by java.util.ResourceBundle
      extended by java.util.ListResourceBundle
          extended by com.antelmann.util.FormattedResourceBundle
Direct Known Subclasses:
Language_lv, Language_ru

public class FormattedResourceBundle
extends ListResourceBundle

a ResourceBundle that gets its content from a specially formatted file, supporting different encodings, in particular UTF8 for global support.

Author:
Holger Antelmann

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
 
Field Summary
protected  String charset
          encoding used
protected  Object[][] contents
           
protected  String fieldSeparator
          separates the key from the value
protected  MyFile file
          denotes the underlying file
protected  String recordSeparator
          separates each entry
 
Fields inherited from class java.util.ResourceBundle
parent
 
Constructor Summary
FormattedResourceBundle(File file, String fieldSeparator)
          uses carriage return and new line as record separator and UTF8 as charset.
FormattedResourceBundle(InputStream stream, String fieldSeparator, String recordSeparator, String charset)
           
FormattedResourceBundle(Reader reader, String fieldSeparator, String recordSeparator)
          uses # as comment indicator
FormattedResourceBundle(Reader reader, String fieldSeparator, String recordSeparator, String commentIndicator)
           
FormattedResourceBundle(URL url, String fieldSeparator)
          uses the platform dependent line break as record separator and UTF8 as charset.
 
Method Summary
static void exportResourceBundle(ResourceBundle bundle, File file, String fieldSeparator)
          uses the platform-dependent line break as record separator and UTF8 as charset.
protected  Object[][] getContents()
           
static DefaultTableModel makeTableModel(ResourceBundle reference, ResourceBundle... other)
          creates a table for allowing a visualized comparison between resource bundles
static ResourceBundle merge(ResourceBundle... bundles)
           
 
Methods inherited from class java.util.ListResourceBundle
getKeys, handleGetObject, handleKeySet
 
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, keySet, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected MyFile file
denotes the underlying file


fieldSeparator

protected String fieldSeparator
separates the key from the value


recordSeparator

protected String recordSeparator
separates each entry


charset

protected String charset
encoding used


contents

protected Object[][] contents
Constructor Detail

FormattedResourceBundle

public FormattedResourceBundle(File file,
                               String fieldSeparator)
                        throws IOException
uses carriage return and new line as record separator and UTF8 as charset.

Throws:
IOException

FormattedResourceBundle

public FormattedResourceBundle(URL url,
                               String fieldSeparator)
                        throws IOException
uses the platform dependent line break as record separator and UTF8 as charset.

Throws:
IOException

FormattedResourceBundle

public FormattedResourceBundle(InputStream stream,
                               String fieldSeparator,
                               String recordSeparator,
                               String charset)
                        throws IOException
Throws:
IOException

FormattedResourceBundle

public FormattedResourceBundle(Reader reader,
                               String fieldSeparator,
                               String recordSeparator)
                        throws IOException
uses # as comment indicator

Throws:
IOException

FormattedResourceBundle

public FormattedResourceBundle(Reader reader,
                               String fieldSeparator,
                               String recordSeparator,
                               String commentIndicator)
                        throws IOException
Throws:
IOException
Method Detail

getContents

protected Object[][] getContents()
Specified by:
getContents in class ListResourceBundle

exportResourceBundle

public static void exportResourceBundle(ResourceBundle bundle,
                                        File file,
                                        String fieldSeparator)
                                 throws IOException
uses the platform-dependent line break as record separator and UTF8 as charset.

Throws:
IOException

makeTableModel

public static DefaultTableModel makeTableModel(ResourceBundle reference,
                                               ResourceBundle... other)
creates a table for allowing a visualized comparison between resource bundles


merge

public static ResourceBundle merge(ResourceBundle... bundles)


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads