|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,String>
org.crosswire.common.util.PropertyMap
public class PropertyMap
A PropertyMap is a Map<String,String> sitting over top a Property file. As such it must be defined in the same way as a java.util.Properties expects.
Properties
,
The GNU Lesser General Public License for details.
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Field Summary | |
---|---|
private PropertyMap |
defaults
Default values for any keys not found in this property map. |
private static long |
serialVersionUID
Serialization ID |
Constructor Summary | |
---|---|
PropertyMap()
Creates an empty property list with no default values. |
|
PropertyMap(PropertyMap defaults)
Creates an empty property map with the specified defaults. |
Method Summary | |
---|---|
String |
get(String key)
Searches for the property with the specified key in this property list. |
String |
get(String key,
String defaultValue)
Searches for the property with the specified key in this property list. |
void |
load(InputStream inStream)
Reads a property list (key and element pairs) from the input byte stream. |
void |
store(OutputStream out,
String comments)
Writes this property list (key and element pairs) in this PropertyMap table to the output stream in a format suitable
for loading into a PropertyMap table using the
load(InputStream) method. |
Methods inherited from class java.util.LinkedHashMap |
---|
clear, containsValue, get, removeEldestEntry |
Methods inherited from class java.util.HashMap |
---|
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Field Detail |
---|
private PropertyMap defaults
private static final long serialVersionUID
Constructor Detail |
---|
public PropertyMap()
public PropertyMap(PropertyMap defaults)
defaults
- the defaults.Method Detail |
---|
public String get(String key)
null
if the property is not found.
key
- the lookup key.
Properties.setProperty(java.lang.String, java.lang.String)
public String get(String key, String defaultValue)
key
- the lookup key.defaultValue
- a default value.
Properties.setProperty(java.lang.String, java.lang.String)
public void load(InputStream inStream) throws IOException
load(InputStream)
and is assumed to use
the ISO 8859-1 character encoding; that is each byte is one Latin1
character. Characters not in Latin1, and certain special characters,
are represented in keys and elements using
Unicode escapes.
The specified stream remains open after this method returns.
inStream
- the input stream.
IOException
- if an error occurred when reading from the
input stream.
IllegalArgumentException
- if the input stream contains a
malformed Unicode escape sequence.public void store(OutputStream out, String comments) throws IOException
PropertyMap
table to the output stream in a format suitable
for loading into a PropertyMap
table using the
load(InputStream)
method.
Properties from the defaults table of this PropertyMap
table (if any) are not written out by this method.
This method outputs the comments, properties keys and values in
the same format as specified in
store(Writer)
,
After the entries have been written, the output stream is flushed. The output stream remains open after this method returns.
out
- an output stream.comments
- a description of the property list.
IOException
- if writing this property list to the specified
output stream throws an IOException.
NullPointerException
- if out
is null.
|
Copyright ยจ 2003-2015 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |