org.apache.tapestry.util.text
Class LocalizedPropertiesLoader

java.lang.Object
  extended by org.apache.tapestry.util.text.LocalizedPropertiesLoader

public class LocalizedPropertiesLoader
extends java.lang.Object

An object that loads a properties file from the provided input stream or reader. This class reads the property file exactly like java.util.Properties, except that it also allows the files to use an encoding other than ISO-8859-1 and all non-ASCII characters are read correctly using the given encoding. In short, non-latin characters no longer need to be quoted using native2ascii.

Since:
4.0
Author:
mb

Constructor Summary
LocalizedPropertiesLoader(java.io.InputStream ins)
          Creates a new loader that will load the properties from the given input stream using the default character encoding
LocalizedPropertiesLoader(java.io.InputStream ins, java.lang.String encoding)
          Creates a new loader that will load the properties from the given input stream using the provided character encoding
LocalizedPropertiesLoader(java.io.Reader reader)
          Creates a new loader that will load the properties from the given reader
 
Method Summary
 void load(java.util.Map properties)
          Read the properties from the provided stream and store them into the given map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalizedPropertiesLoader

public LocalizedPropertiesLoader(java.io.InputStream ins)
Creates a new loader that will load the properties from the given input stream using the default character encoding

Parameters:
ins - the input stream to load the properties from

LocalizedPropertiesLoader

public LocalizedPropertiesLoader(java.io.InputStream ins,
                                 java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException
Creates a new loader that will load the properties from the given input stream using the provided character encoding

Parameters:
ins - the input stream to load the properties from
encoding - the character encoding the be used when reading from the stream
Throws:
java.io.UnsupportedEncodingException - if the name of the encoding cannot be recognized

LocalizedPropertiesLoader

public LocalizedPropertiesLoader(java.io.Reader reader)
Creates a new loader that will load the properties from the given reader

Parameters:
reader - the Reader to load the properties from
Method Detail

load

public void load(java.util.Map properties)
          throws java.io.IOException
Read the properties from the provided stream and store them into the given map

Parameters:
properties - the map where the properties will be stored
Throws:
java.io.IOException - if an error occurs