org.mmbase.remote
Class ExtendedProperties

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--org.mmbase.remote.ExtendedProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ExtendedProperties
extends java.util.Properties

This is a flexible Properties version, it can handle saving of Properties with the comments that will stay in your file.

Version:
28-Oct-1996
Author:
Jan van Oosterom
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  java.lang.String commentPrefix
          the prefix of the comment in the Properties file.
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ExtendedProperties()
           
ExtendedProperties(ExtendedProperties exProp)
          Create an ExtendedProperties with a Allready filled ExtendedProperty list.
ExtendedProperties(java.lang.String filename)
          Create and read an ExtendedProperty from file.
 
Method Summary
 java.util.Vector getPropertyValues(java.lang.String whichProp, java.lang.String delimeter)
          return a Vector of Strings which is parsed from a specified Property.
 void getProps(java.lang.String filename)
          Read to this Property, the Properties from a file.
 void load(java.io.InputStream in)
          Loads properties from an InputStream.
 java.util.Hashtable readProperties(java.lang.String filename)
          Read from Properties and return them.
 java.lang.String save()
           
 void save(java.lang.String filename)
          This routine does not only saves your Properties but also merges your comments if the file already exists if the file doesn't exists the will call the "normal" write routine.
 void saveProperties(java.lang.String filename, java.util.Hashtable propsToSave)
          save Properties to file.
 java.lang.Object setProperty(java.lang.String name, java.lang.String value)
          Set the Property.
 void showContents()
          Dump the contents of this Property to your screen (for debugging)
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, propertyNames, save, 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

commentPrefix

protected java.lang.String commentPrefix
the prefix of the comment in the Properties file. everithing after it will be treaded as comment
Constructor Detail

ExtendedProperties

public ExtendedProperties()

ExtendedProperties

public ExtendedProperties(java.lang.String filename)
Create and read an ExtendedProperty from file.
Parameters:
filename - The file from were to read.

ExtendedProperties

public ExtendedProperties(ExtendedProperties exProp)
Create an ExtendedProperties with a Allready filled ExtendedProperty list.
Parameters:
exProp - The list that will be put in this ExtendedProperty.
Method Detail

readProperties

public java.util.Hashtable readProperties(java.lang.String filename)
Read from Properties and return them.
Parameters:
filename - The file from were to read the Properties.

saveProperties

public void saveProperties(java.lang.String filename,
                           java.util.Hashtable propsToSave)
save Properties to file.
Parameters:
filename - The File were to save them
propsToSave - The Properties which to save.

getPropertyValues

public java.util.Vector getPropertyValues(java.lang.String whichProp,
                                          java.lang.String delimeter)
return a Vector of Strings which is parsed from a specified Property.
Parameters:
whichProp - The Property to get the list from.
delimeter - The delimeter to split wichProp's value with.

getProps

public void getProps(java.lang.String filename)
              throws java.io.IOException
Read to this Property, the Properties from a file.
Parameters:
filename - The file were to read from

load

public void load(java.io.InputStream in)
          throws java.io.IOException
Loads properties from an InputStream. Uses "=" as delimeter between key and value. Does not uses a ":" as delimiter!
Overrides:
load in class java.util.Properties
Parameters:
in - the input stream
Throws:
java.io.IOException - Error when reading from input stream.

save

public void save(java.lang.String filename)
          throws java.io.IOException
This routine does not only saves your Properties but also merges your comments if the file already exists if the file doesn't exists the will call the "normal" write routine.
Parameters:
filename - The file were to save to.

setProperty

public java.lang.Object setProperty(java.lang.String name,
                                    java.lang.String value)
Set the Property.
Overrides:
setProperty in class java.util.Properties
Parameters:
name - the name of the Property (the part in front of the '=' in the Property file)
value - the (new) value of the Property (the part after the '=' in the Property file)

showContents

public void showContents()
Dump the contents of this Property to your screen (for debugging)

save

public java.lang.String save()


MMBase 2002