public class PropertiesFile
extends java.util.Properties
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.
|
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.
|
list, list, load, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames
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
public PropertiesFile(java.io.File file)
file
- the file to save and load topublic PropertiesFile(java.io.File file, java.lang.String header)
file
- the file to save and load toheader
- the file headerpublic java.lang.String getProperty(java.lang.String key)
getProperty
in class java.util.Properties
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
getProperty
in class java.util.Properties
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
setProperty
in class java.util.Properties
public java.io.File getStoreFile()
public boolean load()
public void store()
public void lock()
public boolean tryLock()
public void unlock()
public boolean isHeldByCurrentThread()