csheets.io
Class NamedProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by csheets.io.NamedProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class NamedProperties
extends Properties

An extension of properties, predetermined to be saved in a specified file. If the file exists, any properties therein are loaded.

Author:
Einar Pehrson
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
NamedProperties(File file)
          Creates the named properties.
NamedProperties(File file, Properties defaults)
          Creates the named properties.
 
Method Summary
 void store(String comment)
          Invokes store() using the file that belongs to the properties.
 void storeToXML(String comment)
          Invokes storeToXML() using the file that belongs to the properties.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamedProperties

public NamedProperties(File file)
                throws IOException
Creates the named properties.

Parameters:
file - the file in which the properties are and should be stored
Throws:
IOException - if the file could not be read from

NamedProperties

public NamedProperties(File file,
                       Properties defaults)
Creates the named properties.

Parameters:
defaults - the properties to use as defaults
file - the file in which the properties are and should be stored
Throws:
IOException - if the file could not be read from
Method Detail

store

public void store(String comment)
           throws IOException
Invokes store() using the file that belongs to the properties.

Parameters:
comment - a description of the property list, or null if no comment is desired.
Throws:
IOException - if the file could not be written to

storeToXML

public void storeToXML(String comment)
                throws IOException
Invokes storeToXML() using the file that belongs to the properties.

Parameters:
comment - a description of the property list, or null if no comment is desired.
Throws:
IOException - if the file could not be written to