com.gisgraphy.helper

## Class CommentedProperties

- java.lang.Object
- - java.util.Dictionary<K,V>
  - - java.util.Hashtable<Object,Object>
    - - java.util.Properties
      - - com.gisgraphy.helper.CommentedProperties

- All Implemented Interfaces:
    Serializable, Cloneable, Map<Object,Object>

      public class CommentedProperties
      extends Properties

  The CommentedProperties class is an extension of java.util.Properties to allow retention of comment lines and blank (whitespace only) lines in the properties file. Written for Java version 1.4
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Vector` | `keyData` Use a Vector to keep a copy of lines containing a key, i.e. they are a property.
    `Vector` | `lineData` Use a Vector to keep a copy of lines that are a comment or 'blank'

    - ### Fields inherited from class java.util.Properties

      `defaults`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommentedProperties()`
    `CommentedProperties(Properties defaults)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(String keyString, String value)` Add a Property to the end of the CommentedProperties.
    `void` | `addLine(String line)` Add a comment or blank line or comment to the end of the CommentedProperties.
    `static void` | `editProperty(String filePath, String key, String value)`
    `static void` | `editPropertyFromClassPathRessource(String classPathRessource, String key, String value)`
    `void` | `load(InputStream inStream)` Load properties from the specified InputStream.
    `void` | `store(OutputStream out, String header)` Write the properties to the specified OutputStream.

    - ### Methods inherited from class java.util.Properties

      `getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML, stringPropertyNames`

    - ### Methods inherited from class java.util.Hashtable

      `clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### lineData

          public Vector lineData

      Use a Vector to keep a copy of lines that are a comment or 'blank'

    - #### keyData

          public Vector keyData

      Use a Vector to keep a copy of lines containing a key, i.e. they are a property.

  - ### Constructor Detail

    - #### CommentedProperties

          public CommentedProperties()

    - #### CommentedProperties

          public CommentedProperties(Properties defaults)

      Parameters:
        `defaults` -

  - ### Method Detail

    - #### editProperty

          public static void editProperty(String filePath,
                          String key,
                          String value)

    - #### editPropertyFromClassPathRessource

          public static void editPropertyFromClassPathRessource(String classPathRessource,
                                                String key,
                                                String value)

    - #### load

          public void load(InputStream inStream)
                    throws IOException

      Load properties from the specified InputStream. Overload the load method in Properties so we can keep comment and blank lines.
      Overrides:
        `load` in class `Properties`
      Parameters:
        `inStream` - The InputStream to read.
      Throws:
        `IOException`

    - #### store

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

      Write the properties to the specified OutputStream. Overloads the store method in Properties so we can put back comment and blank lines.
      Overrides:
        `store` in class `Properties`
      Parameters:
        `out` - The OutputStream to write to.
        `header` - Ignored, here for compatability w/ Properties.
      Throws:
        `IOException`

    - #### add

          public void add(String keyString,
                 String value)

      Add a Property to the end of the CommentedProperties.
      Parameters:
        `keyString` - The Property key.
        `value` - The value of this Property.

    - #### addLine

          public void addLine(String line)

      Add a comment or blank line or comment to the end of the CommentedProperties.
      Parameters:
        `line` - The string to add to the end, make sure this is a comment or a 'whitespace' line.

Copyright © 2015. All rights reserved.