EAF 7.4 API

org.enhydra.util
Interface ConfigFileInterface

All Known Implementing Classes:
AbsConfigFile

public interface ConfigFileInterface

ConfigFileInterface is used to manipulate application's configuration files.

Version:
$Revision: 1.1 $
See Also:
Config

Field Summary
static java.lang.String TRAILING_COMMENT
          The key under which the trailing comment is stored.
 
Method Summary
 void addEntry(java.lang.String key, java.lang.String[] values, java.lang.String comment)
          Add an entry to the config file.
 void addEntry(java.lang.String key, java.lang.String value, java.lang.String comment)
          Add an entry to the config file.
 java.lang.String getComment(java.lang.String key)
          Returns the comment associated with a given key, or null if there is no comment.
 com.lutris.util.Config getConfig()
          Returns the Config object representing the config data in the file.
 java.io.File getFile()
          Gets the associated file.
 void removeEntry(java.lang.String key)
          Remove an entry from the config file.
 void setFile(java.io.File file)
          Sets the configuration file.
 void write()
          Writes this config to the associated file.
 void write(java.io.OutputStream outputStream)
          Writes out a config file to the OutputStream specified.
 

Field Detail

TRAILING_COMMENT

static final java.lang.String TRAILING_COMMENT
The key under which the trailing comment is stored.

See Also:
Constant Field Values
Method Detail

getConfig

com.lutris.util.Config getConfig()
Returns the Config object representing the config data in the file.

Returns:
The Config object for this ConfigFile.

getComment

java.lang.String getComment(java.lang.String key)
Returns the comment associated with a given key, or null if there is no comment. Pass in* ConfigFileInterface.TRAILING_COMMENT to get the trailing comment.

Parameters:
key - the key to look up.
Returns:
the associated comment or null

addEntry

void addEntry(java.lang.String key,
              java.lang.String[] values,
              java.lang.String comment)
              throws KeywordValueException
Add an entry to the config file.

Parameters:
key - The config element name.
values - A string array of values.
comment - A string containing a properly commented config file comment.
Throws:
KeywordValueException

addEntry

void addEntry(java.lang.String key,
              java.lang.String value,
              java.lang.String comment)
              throws KeywordValueException
Add an entry to the config file.

Parameters:
key - The config element name.
value - A String value.
comment - A string containing a properly commented config file comment.
Throws:
KeywordValueException

removeEntry

void removeEntry(java.lang.String key)
                 throws KeywordValueException
Remove an entry from the config file.

Parameters:
key - The config element name.
Throws:
KeywordValueException

getFile

java.io.File getFile()
Gets the associated file. If no file is associated with this config, null is returned.

Returns:
associated file

setFile

void setFile(java.io.File file)
Sets the configuration file. This method can be useful in case when in construction of ConfigFileInterface implementation object is not defined associated file.

Parameters:
file - given reference to configuration file represented as File object.

write

void write()
           throws java.io.IOException,
                  java.io.FileNotFoundException
Writes this config to the associated file. If no file is associated with this config, throws a FileNotFoundException

Throws:
java.io.IOException
java.io.FileNotFoundException

write

void write(java.io.OutputStream outputStream)
Writes out a config file to the OutputStream specified. Note that Objects other than String or String[] will be converted into a String.

Parameters:
outputStream - The output stream on which to write the config file.

EAF 7.4 API