Top Description Fields Constructors Methods
org.h2.util

public Class SortedProperties

extends Properties
Class Inheritance
Imports
java.io.BufferedWriter, .ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, .InputStreamReader, .LineNumberReader, .OutputStreamWriter, .PrintWriter, .Writer, java.nio.charset.StandardCharsets, java.util.ArrayList, .Collections, .Enumeration, .Map.Entry, .Properties, .TreeMap, org.h2.store.fs.FileUtils

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

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from java.util.Properties:
defaults

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static SortedProperties

Returns:

the map
fromLines
(String
the string
s
)

Convert a String to a map.

public static boolean

Returns:

the value if set, or the default value if not
getBooleanProperty
(Properties
the properties object
prop
,
String
the key
key
,
boolean
the default value
def
)

Get a boolean property value from a properties object.

public static int

Returns:

the value if set, or the default value if not
getIntProperty
(Properties
the properties object
prop
,
String
the key
key
,
int
the default value
def
)

Get an int property value from a properties object.

public static String

Returns:

the value if set, or the default value if not
getStringProperty
(Properties
the properties object
prop
,
String
the key
key
,
String
the default value
def
)

Get a string property value from a properties object.

public synchronized Enumeration<Object>
keys()

Overrides java.util.Properties.keys.

Returns an enumeration of the keys in this hashtable.

public static synchronized SortedProperties

Returns:

the properties object
loadProperties
(String
the name of the properties file
fileName
)

Load a properties object from a file.

public synchronized void
store(String
the target file name
fileName
)

Store a properties file.

public synchronized String

Returns:

the lines
toLines
()

Convert the map to a list of line in the form key=value.

Inherited from java.util.Properties:
clearclonecomputecomputeIfAbsentcomputeIfPresentcontainscontainsKeycontainsValueelementsentrySetequalsforEachgetgetOrDefaultgetPropertygetPropertyhashCodeisEmptykeySetlistlistloadloadloadFromXMLmergepropertyNamesputputAllputIfAbsentrehashremoveremovereplacereplacereplaceAllsavesetPropertysizestorestorestoreToXMLstoreToXMLstoreToXMLstringPropertyNamestoStringvalues

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.Properties.serialVersionUID.

Constructor Detail

SortedPropertiesback to summary
public SortedProperties()

Method Detail

fromLinesback to summary
public static SortedProperties fromLines(String s)

Convert a String to a map.

Parameters
s:String

the string

Returns:SortedProperties

the map

getBooleanPropertyback to summary
public static boolean getBooleanProperty(Properties prop, String key, boolean def)

Get a boolean property value from a properties object.

Parameters
prop:Properties

the properties object

key:String

the key

def:boolean

the default value

Returns:boolean

the value if set, or the default value if not

getIntPropertyback to summary
public static int getIntProperty(Properties prop, String key, int def)

Get an int property value from a properties object.

Parameters
prop:Properties

the properties object

key:String

the key

def:int

the default value

Returns:int

the value if set, or the default value if not

getStringPropertyback to summary
public static String getStringProperty(Properties prop, String key, String def)

Get a string property value from a properties object.

Parameters
prop:Properties

the properties object

key:String

the key

def:String

the default value

Returns:String

the value if set, or the default value if not

keysback to summary
public synchronized Enumeration<Object> keys()

Overrides java.util.Properties.keys.

Doc from java.util.Hashtable.keys.

Returns an enumeration of the keys in this hashtable. Use the Enumeration methods on the returned object to fetch the keys sequentially. If the hashtable is structurally modified while enumerating over the keys then the results of enumerating are undefined.

Returns:Enumeration<Object>

an enumeration of the keys in this hashtable.

Annotations
@Override
loadPropertiesback to summary
public static synchronized SortedProperties loadProperties(String fileName) throws IOException

Load a properties object from a file.

Parameters
fileName:String

the name of the properties file

Returns:SortedProperties

the properties object

Exceptions
IOException:
on failure
storeback to summary
public synchronized void store(String fileName) throws IOException

Store a properties file. The header and the date is not written.

Parameters
fileName:String

the target file name

Exceptions
IOException:
on failure
toLinesback to summary
public synchronized String toLines()

Convert the map to a list of line in the form key=value.

Returns:String

the lines