org.apache.tapestry.util.text
Class LocalizedPropertiesLoader

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

public class LocalizedPropertiesLoader
extends 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(InputStream ins)
          Creates a new loader that will load the properties from the given input stream using the default character encoding.
LocalizedPropertiesLoader(InputStream ins, String encoding)
          Creates a new loader that will load the properties from the given input stream using the provided character encoding.
LocalizedPropertiesLoader(Reader reader)
          Creates a new loader that will load the properties from the given reader.
 
Method Summary
 void load(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(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(InputStream ins,
                                 String encoding)
                          throws 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:
UnsupportedEncodingException - if the name of the encoding cannot be recognized

LocalizedPropertiesLoader

public LocalizedPropertiesLoader(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(Map properties)
          throws 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:
IOException - if an error occurs


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.