iaik.utils
Class ExtendedProperties

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--iaik.utils.ExtendedProperties
All Implemented Interfaces:
Cloneable, Map, Serializable

public class ExtendedProperties
extends Properties

An enhanced property class. This class extends the basic properties class of Java, by providing type conversion and support for multiple values per key. Note that in difference to the JDK Properties class property names are case insensitive!

Version:
File Revision 18
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
Map.Entry
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ExtendedProperties()
           
ExtendedProperties(Properties props)
          supported for interface compatibility to java.util.Properties only, default properties are not supported.
 
Method Summary
 Object get(Object key)
          Internal use only, public for compatibility to Hashtable only.
 boolean getBoolean(String name, boolean def)
          Get this property value, as a boolean.
 double getDouble(String name, double def)
          Get this property value, as a double.
 File getFile(String name, File def)
          Get this property value, as a File.
 int getInteger(String name, int def)
          Get this property value, as an integer.
 Object[] getObjectArray(String name, Object[] def)
          Get this property as an Object array.
 String getProperty(String key)
           
 String getProperty(String key, String def)
           
 String getString(String name, String def)
          Get this property value, as a String.
 String[] getStringArray(String name, String[] def)
          Get this property as a String array.
 void load(InputStream in)
          Reads a property list from an input stream.
 Object put(Object key, Object value)
          Maps the specified key to the specified value in this hashtable.
 void save(OutputStream out, String header)
           
 void store(OutputStream out, String header)
           
 
Methods inherited from class java.util.Properties
list, list, propertyNames, setProperty
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExtendedProperties

public ExtendedProperties()

ExtendedProperties

public ExtendedProperties(Properties props)
supported for interface compatibility to java.util.Properties only, default properties are not supported.
Method Detail

put

public Object put(Object key,
                  Object value)
Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null.

This method allows to add serveral values for one key. In this case an array is returned.

Overrides:
put in class Hashtable
Parameters:
key - the hashtable key
value - the value
Returns:
the new value of the specified key in this hashtable

get

public Object get(Object key)
Internal use only, public for compatibility to Hashtable only.
Overrides:
get in class Hashtable

getBoolean

public boolean getBoolean(String name,
                          boolean def)
Get this property value, as a boolean.
Parameters:
name - the name of the property to be fetched
def - the default value, if the property isn't defined
Returns:
a boolean

getString

public String getString(String name,
                        String def)
Get this property value, as a String.
Parameters:
name - the name of the property to be fetched
def - the default value, if the property isn't defined
Returns:
a String

getStringArray

public String[] getStringArray(String name,
                               String[] def)
Get this property as a String array.
Parameters:
name - the property's name
def - the default value (if undefined)
Returns:
a String array, or null if the property is undefined.

getObjectArray

public Object[] getObjectArray(String name,
                               Object[] def)
Get this property as an Object array.
Parameters:
name - the property's name
def - the default value (if undefined)
Returns:
a String array, or null if the property is undefined.

getInteger

public int getInteger(String name,
                      int def)
Get this property value, as an integer. If the value starts with "0x" or with "#" the string is interpreted as a hex number.
Parameters:
name - the name of the property to be fetched
def - the default value, if the property isn't defined
Returns:
a integer value

getDouble

public double getDouble(String name,
                        double def)
Get this property value, as a double.
Parameters:
name - the name of the property
def - the default value if undefined
Returns:
a double value

getProperty

public String getProperty(String key,
                          String def)
Overrides:
getProperty in class Properties

getProperty

public String getProperty(String key)
Overrides:
getProperty in class Properties

getFile

public File getFile(String name,
                    File def)
Get this property value, as a File.
Parameters:
name - the name of the property to be fetched
def - the default value, if the property isn't defined
Returns:
an instance of File

load

public void load(InputStream in)
          throws IOException
Reads a property list from an input stream.
Overrides:
load in class Properties
Parameters:
in - the input stream
Throws:
IOException - if an error occurred when reading from the input stream

save

public void save(OutputStream out,
                 String header)
Overrides:
save in class Properties

store

public void store(OutputStream out,
                  String header)
           throws IOException
Overrides:
store in class Properties

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK