com.darwinsys.util
Class FileProperties

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties
              extended bycom.darwinsys.util.FileProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class FileProperties
extends java.util.Properties

The FileProperties class extends Properties, "a persistent set of properties [that] can be saved to a stream or loaded from a stream". This subclass attends to all the mundane details of opening the Stream(s) for actually saving and loading the Properties.

This subclass preserves the useful feature that a property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list.

Version:
$Id: FileProperties.java,v 1.10 2004/03/07 17:14:56 ian Exp $
Author:
Ian F. Darwin, http://www.darwinsys.com/
See Also:
Serialized Form

Field Summary
protected  java.lang.String fileName
          The name of the file this FileProperties represents.
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
FileProperties(java.lang.String loadsaveFileName)
          Construct a FileProperties given a fileName.
FileProperties(java.lang.String loadsaveFileName, java.util.Properties defProp)
          Construct a FileProperties given a fileName and a list of default properties.
 
Method Summary
 void close()
          Deprecated. No longer needed.
 java.lang.String getFileName()
           
 java.util.Properties load()
          Load the properties from the saved filename.
 void save()
          Save the properties to disk for later loading.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
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
 

Field Detail

fileName

protected java.lang.String fileName
The name of the file this FileProperties represents.

Constructor Detail

FileProperties

public FileProperties(java.lang.String loadsaveFileName)
               throws java.io.IOException
Construct a FileProperties given a fileName.


FileProperties

public FileProperties(java.lang.String loadsaveFileName,
                      java.util.Properties defProp)
               throws java.io.IOException
Construct a FileProperties given a fileName and a list of default properties.

Method Detail

getFileName

public java.lang.String getFileName()

load

public java.util.Properties load()
                          throws java.io.IOException
Load the properties from the saved filename. If that fails, try again, tacking on the .properties extension

Throws:
java.io.IOException

save

public void save()
          throws java.io.IOException
Save the properties to disk for later loading.

Throws:
java.io.IOException

close

public void close()
Deprecated. No longer needed.

No longer needed.



Copyright © 2000-2003 Ian F. Darwin. See license.html for usage license.