net.sourceforge.jnlp.util

## Class PropertiesFile

- java.lang.Object
- - java.util.Dictionary<K,V>
  - - java.util.Hashtable<java.lang.Object,java.lang.Object>
    - - java.util.Properties
      - - net.sourceforge.jnlp.util.PropertiesFile

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

      public class PropertiesFile
      extends java.util.Properties

  A properties object backed by a specified file without throwing exceptions. The properties are automatically loaded from the file when the first property is requested, but the save method must be called before changes are saved to the file.
  See Also:
    Serialized Form

- - ### Field Summary

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

      `defaults`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertiesFile(java.io.File file)` Create a properties object backed by the specified file.
    `PropertiesFile(java.io.File file, java.lang.String header)` Create a properties object backed by the specified file.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getProperty(java.lang.String key)`
    `java.lang.String` | `getProperty(java.lang.String key, java.lang.String defaultValue)`
    `java.io.File` | `getStoreFile()`
    `boolean` | `isHeldByCurrentThread()`
    `boolean` | `load()` Ensures that the file backing these properties has been loaded; call this method before calling any method defined by a superclass.
    `void` | `lock()`
    `java.lang.Object` | `setProperty(java.lang.String key, java.lang.String value)` Sets the value for the specified key.
    `void` | `store()` Saves the properties to the file.
    `boolean` | `tryLock()`
    `void` | `unlock()` Unlocks the file.

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

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

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

      `clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values`

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

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

- - ### Constructor Detail

    - #### PropertiesFile

          public PropertiesFile(java.io.File file)

      Create a properties object backed by the specified file.
      Parameters:
        `file` - the file to save and load to

    - #### PropertiesFile

          public PropertiesFile(java.io.File file,
                                java.lang.String header)

      Create a properties object backed by the specified file.
      Parameters:
        `file` - the file to save and load to
        `header` - the file header

  - ### Method Detail

    - #### getProperty

          public java.lang.String getProperty(java.lang.String key)

      Overrides:
        `getProperty` in class `java.util.Properties`
      Returns:
        the value of the specified key, or null if the key does not exist.

    - #### getProperty

          public java.lang.String getProperty(java.lang.String key,
                                              java.lang.String defaultValue)

      Overrides:
        `getProperty` in class `java.util.Properties`
      Returns:
        the value of the specified key, or the default value if the key does not exist.

    - #### setProperty

          public java.lang.Object setProperty(java.lang.String key,
                                              java.lang.String value)

      Sets the value for the specified key.
      Overrides:
        `setProperty` in class `java.util.Properties`
      Returns:
        the previous value

    - #### getStoreFile

          public java.io.File getStoreFile()

      Returns:
        the file backing this properties object.

    - #### load

          public boolean load()

      Ensures that the file backing these properties has been loaded; call this method before calling any method defined by a superclass.
      Returns:
        true, if file was (re-)loaded false, if file was still current

    - #### store

          public void store()

      Saves the properties to the file.

    - #### lock

          public void lock()

    - #### tryLock

          public boolean tryLock()

    - #### unlock

          public void unlock()

      Unlocks the file. Does not do anything if not holding the lock.

    - #### isHeldByCurrentThread

          public boolean isHeldByCurrentThread()

Submit a bug or feature