kiwi.io
Class ConfigFile

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--kiwi.util.Config
                          |
                          +--kiwi.io.ConfigFile

public class ConfigFile
extends Config

Persistent configuration object. This class extends kiwi.util.Config, adding convenience methods for saving a property list to a file, and reading a property list from a file.

Version:
2.0 (11/98)
Author:
Mark Lindner, PING Software Group
See Also:
Properties, Config, Serialized Form

Fields inherited from class kiwi.util.Config
description, support
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ConfigFile(File file)
          Construct a new ConfigFile with a default comment.
ConfigFile(File file, String comment)
          Construct a new ConfigFile.
 
Method Summary
 String getPath()
          Get the absolute path of this configuration file.
 void load()
          Load the configuration parameters from the file.
 void store()
          Save the configuration parameters to the file.
 
Methods inherited from class kiwi.util.Config
addChangeListener, clear, getBoolean, getBoolean, getColor, getColor, getDescription, getInt, getInt, getString, getString, list, put, putBoolean, putColor, putInt, putString, remove, removeChangeListener, setDescription
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigFile

public ConfigFile(File file,
                  String comment)
Construct a new ConfigFile. Note that the object has to be initialized by explicitly loading the properties via a call to load(); the constructor does not preload the file.
Parameters:
file - The File object for this configuration file.
comment - The top-of-file comment (one line).

ConfigFile

public ConfigFile(File file)
Construct a new ConfigFile with a default comment. Note that the object has to be initialized by explicitly loading the properties via a call to load(); the constructor does not preload the file.
Parameters:
file - The File object for this configuration file.
Method Detail

load

public void load()
          throws FileNotFoundException,
                 IOException
Load the configuration parameters from the file. Also fires a ChangeEvent to notify listeners that the object (potentially) changed.
Throws:
FileNotFoundException - If the associated file does not exist.
IOException - If the file could not be read.
See Also:
store()

store

public void store()
           throws IOException
Save the configuration parameters to the file.
Throws:
IOException - If the file could not be written.
See Also:
load()

getPath

public String getPath()
Get the absolute path of this configuration file.