Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.common.util
Class PropertyMap

    java.lang.Object
      java.util.AbstractMap<K,V>
          java.util.HashMap<K,V>
              java.util.LinkedHashMap<String,String>
                  org.crosswire.common.util.PropertyMap

All Implemented Interfaces:
  Serializable, Cloneable, Map<String,String>

    public class PropertyMap

extends LinkedHashMap<String,String>

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.

Author:
  DM Smith
See Also:
  `Properties`, `The GNU Lesser General Public License for details.`, Serialized Form

Nested 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

### defaults

    private PropertyMap defaults

  Default values for any keys not found in this property map.

### serialVersionUID

    private static final long serialVersionUID

  Serialization ID

  See Also:
    Constant Field Values

Constructor Detail

### PropertyMap

    public PropertyMap()

  Creates an empty property list with no default values.

### PropertyMap

    public PropertyMap(PropertyMap defaults)

  Creates an empty property map with the specified defaults.

  Parameters:
    `defaults` - the defaults.

Method Detail

### get

    public String get(String key)

  Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns `null` if the property is not found.

  Parameters:
    `key` - the lookup key.
  Returns:
    the value in this property list with the specified key value.
  See Also:
    `Properties.setProperty(java.lang.String, java.lang.String)`

### get

    public String get(String key,
                      String defaultValue)

  Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.

  Parameters:
    `key` - the lookup key.
    `defaultValue` - a default value.
  Returns:
    the value in this property list with the specified key value.
  See Also:
    `Properties.setProperty(java.lang.String, java.lang.String)`

### load

    public void load(InputStream inStream)
              throws IOException

  Reads a property list (key and element pairs) from the input byte stream. The input stream is in a simple line-oriented format as specified in `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.

  Parameters:
    `inStream` - the input stream.
  Throws:
    `IOException` - if an error occurred when reading from the input stream.
    `IllegalArgumentException` - if the input stream contains a malformed Unicode escape sequence.
  Since:
    1.2

### store

    public void store(OutputStream out,
                      String comments)
               throws IOException

  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.

  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.

  Parameters:
    `out` - an output stream.
    `comments` - a description of the property list.
  Throws:
    `IOException` - if writing this property list to the specified output stream throws an `IOException`.
    `NullPointerException` - if `out` is null.
  Since:
    1.2

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD