Class PropertiesFile
java.lang.Object
net.sourceforge.jnlp.util.PropertiesFile
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.
- Version:
- $Revision: 1.4 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Propertiesactual propertiesprivate booleanprivate final Stringthe header stringprivate longtime of last modification, lazy loaded on getPropertyprivate final LockableFilethe file to save toprivate static final Logger -
Constructor Summary
ConstructorsConstructorDescriptionPropertiesFile(File file) Create a properties object backed by the specified file.PropertiesFile(File file, String header) Create a properties object backed by the specified file. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleanbooleancontainsPropertyValue(String value) entrySet()getProperty(String key) getProperty(String key, String defaultValue) booleanbooleanload()Ensures that the file backing these properties has been loaded; call this method before calling any method defined by a superclass.voidlock()Removes the key (and its corresponding value) from the properties.setProperty(String key, String value) Sets the value for the specified key.voidstore()Saves the properties to the file.booleantryLock()voidunlock()Unlocks the file.
-
Field Details
-
LOG
-
delegate
actual properties -
lockableFile
the file to save to -
header
the header string -
lastStore
private long lastStoretime of last modification, lazy loaded on getProperty -
dirty
private boolean dirty
-
-
Constructor Details
-
PropertiesFile
Create a properties object backed by the specified file.- Parameters:
file- the file to save and load to
-
PropertiesFile
-
-
Method Details
-
getProperty
-
getProperty
-
setProperty
-
containsPropertyKey
-
containsPropertyValue
-
clear
public void clear() -
remove
-
entrySet
-
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()
-