|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.util.DefaultPropertiesPersister
Default implementation of the PropertiesPersister interface. Provides java.util.Properties' native parsing.
Allows for reading from any Reader and writing to any Writer, for example to specify a charset for a properties file. This is a capability that standard java.util.Properties unfortunately lacks: You can only load files using the ISO-8859-1 charset there.
Due to the fact that java.util.Properties' own load and store methods are implemented in a completely unextensible fashion, the persistence code had to be copied and pasted into this class, allowing to specify any Reader or Writer.
All persistence code in this class is subject to the license of the original java.util.Properties file. The unextensible code there should be permission enough to copy and paste it here.
Properties
Field Summary | |
protected static char[] |
hexDigit
A table of hex digits |
static java.lang.String |
keyValueSeparators
|
static java.lang.String |
specialSaveChars
|
static java.lang.String |
strictKeyValueSeparators
|
static java.lang.String |
whiteSpaceChars
|
Constructor Summary | |
DefaultPropertiesPersister()
|
Method Summary | |
protected boolean |
continueLine(java.lang.String line)
Return true if the given line is a line that must be appended to the next line. |
void |
load(java.util.Properties props,
java.io.InputStream is)
Load properties from the given InputStream into the given Properties object. |
void |
load(java.util.Properties props,
java.io.Reader reader)
Load properties from the given Reader into the given Properties object. |
protected java.lang.String |
loadConvert(java.lang.String theString)
Convert encoded \uxxxx to unicode chars and changes special saved chars to their original forms. |
protected java.lang.String |
saveConvert(java.lang.String theString,
boolean escapeSpace)
Convert unicodes to encoded \uxxxx and writes out any of the characters in specialSaveChars with a preceding slash |
void |
store(java.util.Properties props,
java.io.OutputStream os,
java.lang.String header)
Write the contents of the given Properties object to the given OutputStream. |
void |
store(java.util.Properties props,
java.io.Writer writer,
java.lang.String header)
Write the contents of the given Properties object to the given Writer. |
protected char |
toHex(int nibble)
Convert a nibble to a hex character. |
protected void |
writeln(java.io.BufferedWriter bw,
java.lang.String s)
Write the given string to the given writer, following it up with a new line. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String keyValueSeparators
public static final java.lang.String strictKeyValueSeparators
public static final java.lang.String specialSaveChars
public static final java.lang.String whiteSpaceChars
protected static final char[] hexDigit
Constructor Detail |
public DefaultPropertiesPersister()
Method Detail |
public void load(java.util.Properties props, java.io.InputStream is) throws java.io.IOException
PropertiesPersister
load
in interface PropertiesPersister
props
- the Properties object to load intois
- the InputStream to load from
java.io.IOException
- in case of I/O errorsProperties.load(java.io.InputStream)
public void load(java.util.Properties props, java.io.Reader reader) throws java.io.IOException
PropertiesPersister
load
in interface PropertiesPersister
props
- the Properties object to load intoreader
- the Reader to load from
java.io.IOException
- in case of I/O errorsprotected boolean continueLine(java.lang.String line)
protected java.lang.String loadConvert(java.lang.String theString)
public void store(java.util.Properties props, java.io.OutputStream os, java.lang.String header) throws java.io.IOException
PropertiesPersister
store
in interface PropertiesPersister
props
- the Properties object to storeos
- the OutputStream to write toheader
- the description of the property list
java.io.IOException
- in case of I/O errorsProperties.store(java.io.OutputStream, java.lang.String)
public void store(java.util.Properties props, java.io.Writer writer, java.lang.String header) throws java.io.IOException
PropertiesPersister
store
in interface PropertiesPersister
props
- the Properties object to storewriter
- the Writer to write toheader
- the description of the property list
java.io.IOException
- in case of I/O errorsprotected void writeln(java.io.BufferedWriter bw, java.lang.String s) throws java.io.IOException
java.io.IOException
protected java.lang.String saveConvert(java.lang.String theString, boolean escapeSpace)
protected char toHex(int nibble)
nibble
- the nibble to convert
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |