public class PropertiesFileConfiguration extends PropertiesConfiguration
PropertiesConfiguration by the means for an underlying file as
well as optionally automatically saving the configuration in case of changes. When automatically
saving, each change will immediately lead to a save try. Saving will be suspended while the
configuration file is being loaded or already saved. ,.PropertiesConfiguration.DefaultIOFactory, PropertiesConfiguration.IOFactory, PropertiesConfiguration.JupIOFactory, PropertiesConfiguration.JupPropertiesReader, PropertiesConfiguration.JupPropertiesWriter, PropertiesConfiguration.PropertiesReader, PropertiesConfiguration.PropertiesWriter| Modifier and Type | Field and Description |
|---|---|
protected FileHandler |
fileHandler
The handler for the configuration file.
|
protected java.net.URL |
streamUrl
The URL of a stream; the file handler does not have on in case of an input stream.
|
DEFAULT_ENCODING| Constructor and Description |
|---|
PropertiesFileConfiguration(java.io.File file,
java.util.logging.Logger autosaveLogger)
Creates a new properties configuration based on the designated file and loads the configuration
if the file exists.
|
PropertiesFileConfiguration(java.lang.String file,
java.util.logging.Logger autosaveLogger)
Creates a new properties configuration based on the designated file and loads the configuration
if the file exists.
|
PropertiesFileConfiguration(java.net.URL url,
java.io.InputStream stream)
Creates a new properties configuration based on the designated URL and loads the configuration
from the designated stream.
|
PropertiesFileConfiguration(java.net.URL file,
java.util.logging.Logger autosaveLogger)
Creates a new properties configuration based on the designated file and loads the
configuration.
|
| Modifier and Type | Method and Description |
|---|---|
java.net.URL |
getFileUrl()
Gets the URL of the underlying properties file.
|
void |
load()
Loads the configuration from the underlying properties file.
|
void |
save()
Saves the configuration to the underlying properties file.
|
clone, getFooter, getHeader, getInclude, getIOFactory, getLayout, initFileLocator, isIncludesAllowed, read, setFooter, setHeader, setInclude, setIncludesAllowed, setIOFactory, setLayout, unescapeJava, unescapeJava, writeaddPropertyDirect, clearInternal, clearPropertyDirect, containsKeyInternal, getKeysInternal, getPropertyInternal, isEmptyInternal, sizeInternaladdErrorLogListener, addProperty, addPropertyInternal, append, beginRead, beginWrite, clear, clearProperty, cloneInterpolator, containsKey, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getConversionHandler, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getKeys, getKeysInternal, getList, getList, getList, getList, getListDelimiterHandler, getLogger, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getSynchronizer, immutableSubset, initLogger, installInterpolator, interpolate, interpolate, interpolatedConfiguration, isEmpty, isScalarValue, isThrowExceptionOnMissing, lock, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setProperty, setPropertyInternal, setSynchronizer, setThrowExceptionOnMissing, size, subset, unlockaddEventListener, clearErrorListeners, clearEventListeners, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEventsequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddProperty, clear, clearProperty, getInterpolator, installInterpolator, setInterpolator, setProperty, subsetcontainsKey, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, immutableSubset, isEmpty, sizegetSynchronizer, lock, setSynchronizer, unlockprotected final FileHandler fileHandler
protected final java.net.URL streamUrl
public PropertiesFileConfiguration(java.lang.String file,
java.util.logging.Logger autosaveLogger)
throws ConfigurationException
file - The file to base the properties configuration on.autosaveLogger - Whether to automatically save changes to the underlying file. If so,
problems will be logged to this logger. Use null to not automatically
save changes.ConfigurationException - If loading the configuration from the designated file fails, a
ConfigurationException will be thrown.public PropertiesFileConfiguration(java.io.File file,
java.util.logging.Logger autosaveLogger)
throws ConfigurationException
file - The file to base the properties configuration on.autosaveLogger - Whether to automatically save changes to the underlying file. If so,
problems will be logged to this logger. Use null to not automatically
save changes.ConfigurationException - If loading the configuration from the designated file fails, the
file cannot be read or the configuration should be automatically saved but the file
cannot be written, a ConfigurationException will be thrown.public PropertiesFileConfiguration(java.net.URL file,
java.util.logging.Logger autosaveLogger)
throws ConfigurationException
file - The file to base the properties configuration on.autosaveLogger - Whether to automatically save changes to the underlying file. If so,
problems will be logged to this logger. Use null to not automatically
save changes.ConfigurationException - If loading the configuration from the designated file fails, a
ConfigurationException will be thrown. If the file cannot be read or the
configuration should be automatically saved but the file cannot be written, the
ConfigurationException will wrap a FileNotFoundException.public PropertiesFileConfiguration(java.net.URL url,
java.io.InputStream stream)
throws ConfigurationException
url - The URL specifying the properties file. This is merely for information purpose. If
you do not have an URL use PropertiesConfiguration directly.stream - The input stream to read the configuration from.ConfigurationException - If loading the configuration from the designated file fails, a
ConfigurationException will be thrown.public java.net.URL getFileUrl()
public void load()
throws ConfigurationException
ConfigurationException - If there are problems loading the configuration from the
underlying properties file, a ConfigurationException will be thrown.public void save()
throws ConfigurationException
ConfigurationException - If there are problems saving the configuration to the underlying
properties file, a ConfigurationException will be thrown.