java.lang.Object
org.apache.derby.iapi.util.PropertyUtil
- public class PropertyUtil
- extends java.lang.Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertyUtil
public PropertyUtil()
sortProperties
public static java.lang.String sortProperties(java.util.Properties list)
- Sorts a property list and turns the sorted list into a string.
sortProperties
public static java.lang.String sortProperties(java.util.Properties list,
java.lang.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)
copyProperties
public static void copyProperties(java.util.Properties src_prop,
java.util.Properties dest_prop)
- Copy a set of properties from one Property to another.
loadWithTrimmedValues
public static void loadWithTrimmedValues(java.io.InputStream iStr,
java.util.Properties prop)
throws java.io.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."