Top Constructors Methods
org.apache.derby.iapi.util

public Class PropertyUtil

extends Object
Class Inheritance
Imports
java.util.Properties, .Arrays, .Collections, .Set, java.io.InputStream, .IOException

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
copyProperties(Properties
Source set of properties to copy from.
src_prop
,
Properties
Dest Properties to copy into.
dest_prop
)

Copy a set of properties from one Property to another.

public static void
loadWithTrimmedValues(InputStream
An input stream from which the new properties are to be loaded (should already be initialized).
iStr
,
Properties
A set of properties to which the properties from iStr will be added (should already be initialized). properties loaded from 'iStr' (with the extra whitespace (if any) removed from all values), will be returned via the parameter.
prop
)

Read a set of properties from the received input stream, strip off any excess white space that exists in those property values, and then add those newly-read properties to the received Properties object; not explicitly removing the whitespace here can lead to problems.

public static String

Returns:

a string version of the sorted list
sortProperties
(Properties
property list to sort
list
)

Sorts a property list and turns the sorted list into a string.

public static String
sortProperties(Properties list, String indent)

Sorts property list and print out each key=value pair prepended with specific indentation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PropertyUtilback to summary
public PropertyUtil()

Method Detail

copyPropertiesback to summary
public static void copyProperties(Properties src_prop, Properties dest_prop)

Copy a set of properties from one Property to another.

Parameters
src_prop:Properties

Source set of properties to copy from.

dest_prop:Properties

Dest Properties to copy into.

loadWithTrimmedValuesback to summary
public static void loadWithTrimmedValues(InputStream iStr, Properties prop) throws IOException

Read a set of properties from the received input stream, strip off any excess white space that exists in those property values, and then add those newly-read properties to the received Properties object; not explicitly removing the whitespace here can lead to problems. This method exists because of the manner in which the jvm reads properties from file--extra spaces are ignored after a _key_, but if they exist at the _end_ of a property decl line (i.e. as part of a _value_), they are preserved, as outlined in the Java API: "Any whitespace after the key is skipped; if the first non- whitespace character after the key is = or :, then it is ignored and any whitespace characters after it are also skipped. All remaining characters on the line become part of the associated element string."

Parameters
iStr:InputStream

An input stream from which the new properties are to be loaded (should already be initialized).

prop:Properties

A set of properties to which the properties from iStr will be added (should already be initialized). properties loaded from 'iStr' (with the extra whitespace (if any) removed from all values), will be returned via the parameter.

sortPropertiesback to summary
public static String sortProperties(Properties list)

Sorts a property list and turns the sorted list into a string.

Parameters
list:Properties

property list to sort

Returns:String

a string version of the sorted list

sortPropertiesback to summary
public static String sortProperties(Properties list, String indent)

Sorts property list and print out each key=value pair prepended with specific indentation. If indent is null, do not prepend with indentation. The output string shows up in two styles, style 1 looks like { key1=value1, key2=value2, key3=value3 } style 2 looks like key1=value1 key2=value2 key3=value3 where indent goes between the new line and the keys To get style 1, pass in a null indent To get sytle 2, pass in non-null indent (whatever you want to go before the key value)