|
||||||||||
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(java.util.Map propertyMap)
Use the provided argument as the storage location for the properties managed by this object. |
Method Summary | |
---|---|
java.lang.String |
getProperty(java.lang.String key)
Returns the property value corresponding the provided key. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Returns the property value corresponding to the provided key, or the provided default value if no such property exists. |
java.util.Map |
getPropertyMap()
Returns the map containing all properties. |
void |
load(java.io.InputStream ins)
Loads the properties from the given stream using the default character encoding. |
void |
load(java.io.InputStream ins,
java.lang.String encoding)
Loads the properties from the given stream using the provided character encoding. |
void |
load(java.io.Reader reader)
Loads the properties from the given reader. |
void |
setProperty(java.lang.String key,
java.lang.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(java.util.Map propertyMap)
propertyMap
- the map where properties are to be storedMethod Detail |
---|
public java.lang.String getProperty(java.lang.String key)
key
- the property key
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- the property keydefaultValue
- the default value of the property
public void setProperty(java.lang.String key, java.lang.String value)
key
- the property keyvalue
- the property valuepublic java.util.Map getPropertyMap()
public void load(java.io.InputStream ins) throws java.io.IOException
Properties
,
but it also handles non-ascii symbols.
ins
- the stream to load the properties from
java.io.IOException
public void load(java.io.InputStream ins, java.lang.String encoding) throws java.io.UnsupportedEncodingException, java.io.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
java.io.IOException
java.io.UnsupportedEncodingException
public void load(java.io.Reader reader) throws java.io.IOException
Properties
,
but it also handles non-ascii symbols.
reader
- the reader to load the properties from
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |