public class PropertyMap extends LinkedHashMap<String,String>
Properties
,
The GNU Lesser General Public License for details.
,
Serialized FormAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
private PropertyMap |
defaults
Default values for any keys not found in this property map.
|
private static long |
serialVersionUID
Serialization ID
|
Constructor and Description |
---|
PropertyMap()
Creates an empty property list with no default values.
|
PropertyMap(PropertyMap defaults)
Creates an empty property map with the specified defaults.
|
Modifier and Type | Method and Description |
---|---|
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. |
clear, containsValue, get, removeEldestEntry
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
equals, hashCode, toString
private PropertyMap defaults
private static final long serialVersionUID
public PropertyMap()
public PropertyMap(PropertyMap defaults)
defaults
- the defaults.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.