org.springframework.util
Interface PropertiesPersister

All Known Implementing Classes:
DefaultPropertiesPersister

public interface PropertiesPersister

Strategy interface for persisting java.util.Properties, allowing for pluggable parsing strategies.

The default implementation is DefaultPropertiesPersister, providing the native parsing of java.util.Properties, but allowing for reading from any Reader and writing to any Writer (which allows to specify an encoding for a properties file).

As of Spring 1.2.2, this interface also supports properties XML files, through the loadFromXml and storeToXml methods. The default implementations delegate to JDK 1.5's corresponding methods.

Since:
10.03.2004
Author:
Juergen Hoeller
See Also:
DefaultPropertiesPersister, Properties

Method Summary
 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.
 void loadFromXml(java.util.Properties props, java.io.InputStream is)
          Load properties from the given XML InputStream into the given Properties object.
 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.
 void storeToXml(java.util.Properties props, java.io.OutputStream os, java.lang.String header)
          Write the contents of the given Properties object to the given XML OutputStream.
 void storeToXml(java.util.Properties props, java.io.OutputStream os, java.lang.String header, java.lang.String encoding)
          Write the contents of the given Properties object to the given XML OutputStream.
 

Method Detail

load

void load(java.util.Properties props,
          java.io.InputStream is)
          throws java.io.IOException
Load properties from the given InputStream into the given Properties object.

Parameters:
props - the Properties object to load into
is - the InputStream to load from
Throws:
java.io.IOException - in case of I/O errors
See Also:
Properties.load(java.io.Reader)

load

void load(java.util.Properties props,
          java.io.Reader reader)
          throws java.io.IOException
Load properties from the given Reader into the given Properties object.

Parameters:
props - the Properties object to load into
reader - the Reader to load from
Throws:
java.io.IOException - in case of I/O errors

store

void store(java.util.Properties props,
           java.io.OutputStream os,
           java.lang.String header)
           throws java.io.IOException
Write the contents of the given Properties object to the given OutputStream.

Parameters:
props - the Properties object to store
os - the OutputStream to write to
header - the description of the property list
Throws:
java.io.IOException - in case of I/O errors
See Also:
Properties.store(java.io.Writer, java.lang.String)

store

void store(java.util.Properties props,
           java.io.Writer writer,
           java.lang.String header)
           throws java.io.IOException
Write the contents of the given Properties object to the given Writer.

Parameters:
props - the Properties object to store
writer - the Writer to write to
header - the description of the property list
Throws:
java.io.IOException - in case of I/O errors

loadFromXml

void loadFromXml(java.util.Properties props,
                 java.io.InputStream is)
                 throws java.io.IOException
Load properties from the given XML InputStream into the given Properties object.

Parameters:
props - the Properties object to load into
is - the InputStream to load from
Throws:
java.io.IOException - in case of I/O errors
See Also:
Properties.loadFromXML(java.io.InputStream)

storeToXml

void storeToXml(java.util.Properties props,
                java.io.OutputStream os,
                java.lang.String header)
                throws java.io.IOException
Write the contents of the given Properties object to the given XML OutputStream.

Parameters:
props - the Properties object to store
os - the OutputStream to write to
header - the description of the property list
Throws:
java.io.IOException - in case of I/O errors
See Also:
Properties.storeToXML(java.io.OutputStream, String)

storeToXml

void storeToXml(java.util.Properties props,
                java.io.OutputStream os,
                java.lang.String header,
                java.lang.String encoding)
                throws java.io.IOException
Write the contents of the given Properties object to the given XML OutputStream.

Parameters:
props - the Properties object to store
os - the OutputStream to write to
encoding - the encoding to use
header - the description of the property list
Throws:
java.io.IOException - in case of I/O errors
See Also:
Properties.storeToXML(java.io.OutputStream, String, String)