org.h2.util
Class SortedProperties

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 org.h2.util.SortedProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class SortedProperties
extends java.util.Properties

Sorted properties file. This implementation requires that store() internally calls keys().

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
SortedProperties()
           
 
Method Summary
static SortedProperties fromLines(java.lang.String s)
          Convert a String to a map.
static boolean getBooleanProperty(java.util.Properties prop, java.lang.String key, boolean def)
          Get a boolean property value from a properties object.
static int getIntProperty(java.util.Properties prop, java.lang.String key, int def)
          Get an int property value from a properties object.
 java.util.Enumeration<java.lang.Object> keys()
           
static SortedProperties loadProperties(java.lang.String fileName)
          Load a properties object from a file.
 void store(java.lang.String fileName)
          Store a properties file.
 java.lang.String toLines()
          Convert the map to a list of line in the form key=value.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortedProperties

public SortedProperties()
Method Detail

keys

public java.util.Enumeration<java.lang.Object> keys()
Overrides:
keys in class java.util.Hashtable<java.lang.Object,java.lang.Object>

getBooleanProperty

public static boolean getBooleanProperty(java.util.Properties prop,
                                         java.lang.String key,
                                         boolean def)
Get a boolean property value from a properties object.

Parameters:
prop - the properties object
key - the key
def - the default value
Returns:
the value if set, or the default value if not

getIntProperty

public static int getIntProperty(java.util.Properties prop,
                                 java.lang.String key,
                                 int def)
Get an int property value from a properties object.

Parameters:
prop - the properties object
key - the key
def - the default value
Returns:
the value if set, or the default value if not

loadProperties

public static SortedProperties loadProperties(java.lang.String fileName)
                                       throws java.io.IOException
Load a properties object from a file.

Parameters:
fileName - the name of the properties file
Returns:
the properties object
Throws:
java.io.IOException

store

public void store(java.lang.String fileName)
           throws java.io.IOException
Store a properties file. The header and the date is not written.

Parameters:
fileName - the target file name
Throws:
java.io.IOException

toLines

public java.lang.String toLines()
Convert the map to a list of line in the form key=value.

Returns:
the lines

fromLines

public static SortedProperties fromLines(java.lang.String s)
Convert a String to a map.

Parameters:
s - the string
Returns:
the map