public interface FileConfiguration extends Configuration
Modifier and Type | Method and Description |
---|---|
String |
getBasePath()
Returns the base path.
|
String |
getEncoding()
Return the encoding used to store the configuration file.
|
File |
getFile()
Return the file where the configuration is stored.
|
String |
getFileName()
Return the name of the file.
|
ReloadingStrategy |
getReloadingStrategy()
Return the reloading strategy.
|
URL |
getURL()
Return the URL where the configuration is stored.
|
boolean |
isAutoSave()
Tells if properties are automatically saved to the disk.
|
void |
load()
Load the configuration from the underlying URL.
|
void |
load(File file)
Load the configuration from the specified file.
|
void |
load(InputStream in)
Load the configuration from the specified stream, using the encoding
returned by
getEncoding() . |
void |
load(InputStream in,
String encoding)
Load the configuration from the specified stream, using the specified
encoding.
|
void |
load(Reader in)
Load the configuration from the specified reader.
|
void |
load(String fileName)
Locate the specified file and load the configuration.
|
void |
load(URL url)
Load the configuration from the specified URL.
|
void |
reload()
Reload the configuration.
|
void |
save()
Save the configuration.
|
void |
save(File file)
Save the configuration to the specified file.
|
void |
save(OutputStream out)
Save the configuration to the specified stream, using the encoding
returned by
getEncoding() . |
void |
save(OutputStream out,
String encoding)
Save the configuration to the specified stream, using the specified
encoding.
|
void |
save(String fileName)
Save the configuration to the specified file.
|
void |
save(URL url)
Save the configuration to the specified URL.
|
void |
save(Writer out)
Save the configuration to the specified writer.
|
void |
setAutoSave(boolean autoSave)
Enable or disable the automatical saving of modified properties to the disk.
|
void |
setBasePath(String basePath)
Sets the base path.
|
void |
setEncoding(String encoding)
Set the encoding used to store the configuration file.
|
void |
setFile(File file)
Set the file where the configuration is stored.
|
void |
setFileName(String fileName)
Set the name of the file.
|
void |
setReloadingStrategy(ReloadingStrategy strategy)
Set the reloading strategy.
|
void |
setURL(URL url)
The URL where the configuration is stored.
|
addProperty, clear, clearProperty, containsKey, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, isEmpty, setProperty, subset
void load() throws ConfigurationException
ConfigurationException
- if an error occurs during the load operationvoid load(String fileName) throws ConfigurationException
fileName
- the name of the file loadedConfigurationException
- if an error occurs during the load operationvoid load(File file) throws ConfigurationException
file
- the loaded fileConfigurationException
- if an error occurs during the load operationvoid load(URL url) throws ConfigurationException
url
- the URL of the file loadedConfigurationException
- if an error occurs during the load operationvoid load(InputStream in) throws ConfigurationException
getEncoding()
.in
- the input streamConfigurationException
- if an error occurs during the load operationvoid load(InputStream in, String encoding) throws ConfigurationException
in
- the input streamencoding
- the encoding used. null
to use the default encodingConfigurationException
- if an error occurs during the load operationvoid load(Reader in) throws ConfigurationException
in
- the readerConfigurationException
- if an error occurs during the load operationvoid save() throws ConfigurationException
ConfigurationException
- if an error occurs during the save operationvoid save(String fileName) throws ConfigurationException
fileName
- the name of the file to be savedConfigurationException
- if an error occurs during the save operationvoid save(File file) throws ConfigurationException
file
- specifies the file to be savedConfigurationException
- if an error occurs during the save operationvoid save(URL url) throws ConfigurationException
url
- the URLConfigurationException
- if an error occurs during the save operationvoid save(OutputStream out) throws ConfigurationException
getEncoding()
.out
- the output streamConfigurationException
- if an error occurs during the save operationvoid save(OutputStream out, String encoding) throws ConfigurationException
out
- the output streamencoding
- the encoding to be usedConfigurationException
- if an error occurs during the save operationvoid save(Writer out) throws ConfigurationException
out
- the writerConfigurationException
- if an error occurs during the save operationString getFileName()
void setFileName(String fileName)
fileName
- the name of the fileString getBasePath()
setFile()
or setURL()
were used, the base
path typically points to the parent directory of the configuration file
(e.g. for the URL file:/temp/test.properties
the base path
will be file:/temp/
). If the base path was explictly set
using setBasePath()
, this method will return the exact
value specified here without further modifications.AbstractFileConfiguration.setBasePath(String)
void setBasePath(String basePath)
setBasePath()
and
setFileName()
can be used together to specify the location
of the configuration file to be loaded. If relative file names are to
be resolved (e.g. for the include files supported by
PropertiesConfiguration
), this base path will be used.basePath
- the base path.File getFile()
void setFile(File file)
file
- the fileURL getURL()
void setURL(URL url)
url
- the URLvoid setAutoSave(boolean autoSave)
autoSave
- true
to enable, false
to disableboolean isAutoSave()
true
if auto-saving is enabled, false
otherwiseReloadingStrategy getReloadingStrategy()
void setReloadingStrategy(ReloadingStrategy strategy)
strategy
- the reloading strategy to usevoid reload()
String getEncoding()
void setEncoding(String encoding)
encoding
- the encoding to useCopyright © 2018 JBoss by Red Hat. All rights reserved.