|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.autonomy.config.ConfigEntry | +--com.autonomy.config.ConfigSection | +--com.autonomy.config.ConfigFile
Solid implementation of the ConfigEntry. This is used to read standard Autonomy configuration
files. Thus the following assumptions are made about the structure:
The ConfigFile object contains only ConfigSections and those ConfigSections contain
only ConfigKeys. This assumption forms the basis of the read / set methods detailed below
ConfigSection
,
ConfigKey
Field Summary |
Fields inherited from class com.autonomy.config.ConfigEntry |
BEGIN_CLOSE, BEGIN_OPEN, COMMENT_END, COMMENT_START, CRLF, END_CLOSE, END_OPEN, IS_FILE, IS_KEY, IS_SECTION, IS_UNKNOWN, KEY_VALUE_SEPARATOR, m_nType, USE_END_TAG |
Constructor Summary | |
ConfigFile()
Constructor. |
|
ConfigFile(com.autonomy.config.ConfigSection csSection)
|
|
ConfigFile(java.lang.String sFilePath)
Constructor. |
Method Summary | |
void |
display()
Writes the whole file to standard out |
java.lang.String |
getFilename()
Get the filename that this ConfigFile was read from |
void |
parse(java.lang.String sConfig)
This method parses a String containing Autonomy configuration settings into the ConfigFile object |
void |
read(java.lang.String sFilename)
Read in a config file. |
boolean |
readBoolean(java.lang.String sSection,
java.lang.String sKey)
Get a key from a named section as a boolean |
boolean |
readBoolean(java.lang.String sSection,
java.lang.String sKey,
boolean bDefault)
Get a key from a named section as a boolean |
double |
readDouble(java.lang.String sSection,
java.lang.String sKey)
Get a key from a named section as a double |
double |
readDouble(java.lang.String sSection,
java.lang.String sKey,
double dDefault)
Get a key from a named section as a double |
int |
readInt(java.lang.String sSection,
java.lang.String sKey)
Get a key from a named section as an int |
int |
readInt(java.lang.String sSection,
java.lang.String sKey,
int nDefault)
Get a key from a named section as an int |
long |
readLong(java.lang.String sSection,
java.lang.String sKey)
Get a key from a named section as a long |
long |
readLong(java.lang.String sSection,
java.lang.String sKey,
long lnDefault)
Get a key from a named section as a long |
java.lang.String |
readString(java.lang.String sSection,
java.lang.String sKey)
Get a key from a named section |
java.lang.String |
readString(java.lang.String sSection,
java.lang.String sKey,
java.lang.String sDefault)
Get a key from a named section |
void |
setString(java.lang.String sSection,
java.lang.String sKey,
java.lang.String sValue)
Set a key in a specified section, overwriting any existing entries there |
java.lang.String |
toString()
Creates a string representing the whole file as it would be stored on the file system |
void |
write()
Writes the file out to the same location it was read from |
int |
writeTo(java.lang.String sConfigFileName,
boolean dosFormat)
Write the config out to a file on disk |
Methods inherited from class com.autonomy.config.ConfigSection |
delete, getKeyNames, getKeyNamesVector, getName, getOriginalName, getSectionNames, getSectionNamesVector, readBoolean, readDouble, readInt, readKey, readLong, readSection, readSectionSafely, setKey, setSection, setString, toHashtable |
Methods inherited from class com.autonomy.config.ConfigEntry |
getComments, getOriginalName, getValue, setComments, stringIsValidName |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConfigFile()
public ConfigFile(com.autonomy.config.ConfigSection csSection)
public ConfigFile(java.lang.String sFilePath) throws java.io.FileNotFoundException
sFilePath
- Full path to configuration fileMethod Detail |
public void read(java.lang.String sFilename) throws java.io.FileNotFoundException
sFilename
- Fully Qualified Path of the config file to read
java.io.FileNotFoundException
public void parse(java.lang.String sConfig)
sConfig
- Buffer containing configuration settingspublic int writeTo(java.lang.String sConfigFileName, boolean dosFormat)
sConfigFileName
- Name of the config file to createdosFormat
- whether to end each line with \n\r or just \n
public void write()
public java.lang.String toString()
toString
in class ConfigSection
public void display()
display
in class ConfigSection
public java.lang.String readString(java.lang.String sSection, java.lang.String sKey, java.lang.String sDefault)
sSection
- Name of section to read the key fromsKey
- Name of the key to readsDefault
- Value to return if the section or key is not found
public java.lang.String readString(java.lang.String sSection, java.lang.String sKey)
readString
in class ConfigSection
sSection
- Name of section to read the key fromsKey
- Name of the key to read
public int readInt(java.lang.String sSection, java.lang.String sKey, int nDefault)
sSection
- Name of section to read the key fromsKey
- Name of the key to readnDefault
- Value to return if the section or key is not found or cannot be converted to an int
public int readInt(java.lang.String sSection, java.lang.String sKey)
sSection
- Name of section to read the key fromsKey
- Name of the key to read
public long readLong(java.lang.String sSection, java.lang.String sKey, long lnDefault)
sSection
- Name of section to read the key fromsKey
- Name of the key to readlnDefault
- Value to return if the section or key is not found or cannot be converted to an int
public long readLong(java.lang.String sSection, java.lang.String sKey)
sSection
- Name of section to read the key fromsKey
- Name of the key to read
public boolean readBoolean(java.lang.String sSection, java.lang.String sKey, boolean bDefault)
sSection
- Name of section to read the key fromsKey
- Name of the key to readbDefault
- Value to return if the section or key is not found or cannot be converted to an int
public boolean readBoolean(java.lang.String sSection, java.lang.String sKey)
sSection
- Name of section to read the key fromsKey
- Name of the key to read
public double readDouble(java.lang.String sSection, java.lang.String sKey, double dDefault)
sSection
- Name of section to read the key fromsKey
- Name of the key to readdDefault
- Value to return if the section or key is not found or cannot be converted to a double
public double readDouble(java.lang.String sSection, java.lang.String sKey)
sSection
- Name of section to read the key fromsKey
- Name of the key to read
public void setString(java.lang.String sSection, java.lang.String sKey, java.lang.String sValue)
sSection
- Name of section to set the key insKey
- Name of the key to setpublic java.lang.String getFilename()
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |