public class PersistentProperties
extends java.util.Properties
Modifier and Type | Field and Description |
---|---|
protected boolean |
_savePaused |
protected int |
maxStorageFrequencyMS |
protected boolean |
writeQueued |
protected java.lang.Thread |
writeThread |
Constructor and Description |
---|
PersistentProperties(java.io.File file,
java.lang.String comments) |
PersistentProperties(java.io.File file,
java.lang.String comments,
boolean requireInitial)
Creates a new PersistentProperties object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
copyFile(java.io.File source,
java.io.File dest) |
java.io.File |
getFile() |
int |
getMaxStorageFrequencyMS()
Returns the maximum rate at which the file will be written.
|
java.io.File |
getTempFile() |
boolean |
isNew() |
java.util.Set<java.lang.Object> |
keySet() |
protected void |
potentiallyExecuteWrite() |
java.lang.Object |
remove(java.lang.Object key) |
java.lang.Object |
removeIntermediate(java.lang.Object key) |
void |
setMaxStorageFrequencyMS(int maxStorageFrequencyMS)
Sets the maximum rate at which the file will be written.
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value) |
java.lang.Object |
setPropertyIntermediate(java.lang.String key,
java.lang.String value)
Sets a property without pesisting the change.
|
void |
storeChanges()
Do the following to ensure there is always a well-formed file on the HD
Write file to temp file
Copy temp file to main file
|
protected void |
tryLoad(java.io.File file)
Tries to call super.loadFromXML with an input stream from this file.
|
getProperty, getProperty, 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, merge, put, putAll, putIfAbsent, rehash, remove, replace, replace, replaceAll, size, toString, values
protected transient boolean _savePaused
protected int maxStorageFrequencyMS
protected transient java.lang.Thread writeThread
protected transient boolean writeQueued
public PersistentProperties(java.io.File file, java.lang.String comments) throws java.io.IOException
java.io.IOException
public PersistentProperties(java.io.File file, java.lang.String comments, boolean requireInitial) throws java.io.IOException
file
- comments
- requireInitial
- Whether or not a valid file or _clean file is required. If
false, the constructor will accept the situation where none of
the 3 files exist.java.io.IOException
public int getMaxStorageFrequencyMS()
public void setMaxStorageFrequencyMS(int maxStorageFrequencyMS)
public boolean isNew()
public java.io.File getFile()
public java.io.File getTempFile()
protected void tryLoad(java.io.File file) throws java.io.IOException
file
- java.io.IOException
- if anything goes wrong with the load.public java.lang.Object removeIntermediate(java.lang.Object key)
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.Object,java.lang.Object>
remove
in class java.util.Hashtable<java.lang.Object,java.lang.Object>
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
setProperty
in class java.util.Properties
public java.lang.Object setPropertyIntermediate(java.lang.String key, java.lang.String value)
key
- value
- public java.util.Set<java.lang.Object> keySet()
keySet
in interface java.util.Map<java.lang.Object,java.lang.Object>
keySet
in class java.util.Hashtable<java.lang.Object,java.lang.Object>
public void storeChanges()
protected void potentiallyExecuteWrite()
protected void copyFile(java.io.File source, java.io.File dest) throws java.io.IOException
java.io.IOException