|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.configuration.AbstractConfiguration
org.apache.commons.configuration.BaseConfiguration
org.apache.commons.configuration.BasePathConfiguration
org.apache.commons.configuration.BasePropertiesConfiguration
loads the configuration from a properties file.
The properties file syntax is explained here:
key = value
Here is an example of a valid extended properties file:
# lines starting with # are comments # This is the simplest property key = value # A long property may be separated on multiple lines longvalue = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # This is a property with many tokens tokens_on_a_line = first token, second token # This sequence generates exactly the same result tokens_on_multiple_lines = first token tokens_on_multiple_lines = second token # commas may be escaped in tokens commas.excaped = Hi\, what'up? # properties can reference other properties base.prop = /base first.prop = ${base.prop}/first second.prop = ${first.prop}/second
Nested Class Summary | |
(package private) class |
BasePropertiesConfiguration.PropertiesReader
This class is used to read properties lines. |
(package private) class |
BasePropertiesConfiguration.PropertiesWriter
This class is used to write properties lines. |
Nested classes inherited from class org.apache.commons.configuration.AbstractConfiguration |
AbstractConfiguration.Container, AbstractConfiguration.PropertiesTokenizer |
Field Summary | |
protected static java.lang.String |
include
This is the name of the property that can point to other properties file for including other properties files. |
private boolean |
includesAllowed
Allow file inclusion or not |
Fields inherited from class org.apache.commons.configuration.BasePathConfiguration |
|
Fields inherited from class org.apache.commons.configuration.BaseConfiguration |
|
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
defaults, END_TOKEN, START_TOKEN |
Constructor Summary | |
BasePropertiesConfiguration()
|
Method Summary | |
java.lang.String |
getInclude()
Gets the property value for including other properties files. |
boolean |
getIncludesAllowed()
Reports the status of file inclusion. |
protected abstract java.io.InputStream |
getPropertyStream(java.lang.String resourceName)
Implementations of this class must implement this method. |
void |
load(java.io.InputStream input)
Load the properties from the given input stream. |
void |
load(java.io.InputStream input,
java.lang.String enc)
Load the properties from the given input stream and using the specified encoding. |
void |
save(java.lang.String filename)
save properties to a file. |
void |
setInclude(java.lang.String inc)
Sets the property value for including other properties files. |
protected void |
setIncludesAllowed(boolean includesAllowed)
Controls whether additional files can be loaded by the include = |
Methods inherited from class org.apache.commons.configuration.BasePathConfiguration |
getBasePath, setBasePath |
Methods inherited from class org.apache.commons.configuration.BaseConfiguration |
addPropertyDirect, clearProperty, containsKey, getKeys, getPropertyDirect, isEmpty |
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration |
addProperty, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, interpolate, interpolateHelper, processString, setProperty, subset, testBoolean |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean includesAllowed
protected static java.lang.String include
Constructor Detail |
public BasePropertiesConfiguration()
Method Detail |
protected abstract java.io.InputStream getPropertyStream(java.lang.String resourceName) throws java.io.IOException
resourceName
- The Resource to load
java.io.IOException
- Error while loading the properties filepublic void load(java.io.InputStream input) throws java.io.IOException
input
- An InputStream.
java.io.IOException
public void load(java.io.InputStream input, java.lang.String enc) throws java.io.IOException
input
- An InputStream.enc
- An encoding.
java.io.IOException
public void save(java.lang.String filename) throws java.io.IOException
filename
- name of the properties file
java.io.IOException
public java.lang.String getInclude()
public void setInclude(java.lang.String inc)
inc
- A String.protected void setIncludesAllowed(boolean includesAllowed)
includesAllowed
- includesAllowed True if Includes are allowed.public boolean getIncludesAllowed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |