|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.util.text.LocalizedProperties
public class LocalizedProperties
A version of java.util.Properties that can read the properties from files using an encoding other than ISO-8859-1. All non-latin characters are read correctly using the given encoding and no longer need to be quoted using native2ascii. In addition, the properties may be stored in an arbitrary map, rather than only in Properties. For example, using LinkedHashMap will preserve the order of the properties as defined in the file.
Constructor Summary | |
---|---|
LocalizedProperties()
Create a new object with an empty property storage. |
|
LocalizedProperties(Map propertyMap)
Use the provided argument as the storage location for the properties managed by this object. |
Method Summary | |
---|---|
String |
getProperty(String key)
Returns the property value corresponding the provided key. |
String |
getProperty(String key,
String defaultValue)
Returns the property value corresponding to the provided key, or the provided default value if no such property exists. |
Map |
getPropertyMap()
Returns the map containing all properties. |
void |
load(InputStream ins)
Loads the properties from the given stream using the default character encoding. |
void |
load(InputStream ins,
String encoding)
Loads the properties from the given stream using the provided character encoding. |
void |
load(Reader reader)
Loads the properties from the given reader. |
void |
setProperty(String key,
String value)
Stores a property value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalizedProperties()
public LocalizedProperties(Map propertyMap)
propertyMap
- the map where properties are to be storedMethod Detail |
---|
public String getProperty(String key)
key
- the property key
public String getProperty(String key, String defaultValue)
key
- the property keydefaultValue
- the default value of the property
public void setProperty(String key, String value)
key
- the property keyvalue
- the property valuepublic Map getPropertyMap()
public void load(InputStream ins) throws IOException
Properties
, but it also handles non-ascii symbols.
ins
- the stream to load the properties from
IOException
public void load(InputStream ins, String encoding) throws IOException
Properties
, but it also handles non-ascii symbols.
ins
- the stream to load the properties fromencoding
- the encoding the use when parsing the stream
IOException
public void load(Reader reader) throws IOException
Properties
, but
it also handles non-ascii symbols.
reader
- the reader to load the properties from
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |