com.darwinsys.util
Class FileProperties

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

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.13 2006/09/20 14:51:16 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.io.InputStream is)
           
FileProperties(java.lang.String loadsaveFileName)
          Construct a FileProperties given a fileName.
FileProperties(java.lang.String readonlyFileName, java.lang.Class clazz)
           
FileProperties(java.lang.String loadsaveFileName, java.util.Properties defProp)
          Construct a FileProperties given a fileName and a list of default properties.
 
Method Summary
 java.lang.String getFileName()
           
 java.util.Iterator<java.lang.String> iterator()
           
 java.util.Properties load()
          Load the properties from the saved filename.
 void save()
          Deprecated. Use store(OutputStream) instead.
 
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
 

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.

Throws:
java.io.IOException

FileProperties

public FileProperties(java.lang.String readonlyFileName,
                      java.lang.Class clazz)
               throws java.io.IOException
Throws:
java.io.IOException

FileProperties

public FileProperties(java.io.InputStream is)
               throws java.io.IOException
Throws:
java.io.IOException

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.

Throws:
java.io.IOException
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

@Deprecated
public void save()
          throws java.io.IOException
Deprecated. Use store(OutputStream) instead.

Save the properties to disk for later loading. May only be used if this FileProperties was created with a filename; otherwise, use store() and give an OutputStream

Throws:
java.io.IOException

iterator

public java.util.Iterator<java.lang.String> iterator()


Copyright © 1996-2004 Ian F. Darwin. See license.html for usage license.