PropertiesPersister interface.
Follows the native parsing of java.util.Properties.
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 lacked up until JDK 5:
You were only able to load files using the ISO-8859-1 charset there.
Loading from and storing to a stream delegates to Properties.load
and Properties.store, respectively, to be fully compatible with
the Unicode conversion as implemented by the JDK Properties class. As of JDK 6,
Properties.load/store is also used for readers/writers, effectively
turning this class into a plain backwards compatibility adapter.
The persistence code that works with Reader/Writer follows the JDK's parsing strategy but does not implement Unicode conversion, because the Reader/Writer should already apply proper decoding/encoding of characters. If you prefer to escape unicode characters in your properties files, do not specify an encoding for a Reader/Writer (like ReloadableResourceBundleMessageSource's "defaultEncoding" and "fileEncodings" properties).
java.util.Properties , java.util.Properties#load , java.util.Properties#store
| Modifier and Type | Field and Description |
|---|---|
| public static final DefaultPropertiesPersister | INSTANCE
A convenient constant for a default |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | load(Properties
the Properties object to load into props, InputStream the InputStream to load from is)Implements org. Load properties from the given InputStream into the given Properties object. |
| public void | load(Properties
the Properties object to load into props, Reader the Reader to load from reader)Implements org. Load properties from the given Reader into the given Properties object. |
| public void | loadFromXml(Properties
the Properties object to load into props, InputStream the InputStream to load from is)Implements org. Load properties from the given XML InputStream into the given Properties object. |
| public void | store(Properties
the Properties object to store props, OutputStream the OutputStream to write to os, String the description of the property list header)Implements org. Write the contents of the given Properties object to the given OutputStream. |
| public void | store(Properties
the Properties object to store props, Writer the Writer to write to writer, String the description of the property list header)Implements org. Write the contents of the given Properties object to the given Writer. |
| public void | storeToXml(Properties
the Properties object to store props, OutputStream the OutputStream to write to os, String the description of the property list header)Implements org. Write the contents of the given Properties object to the given XML OutputStream. |
| public void | storeToXml(Properties
the Properties object to store props, OutputStream the OutputStream to write to os, String the description of the property list header, String the encoding to use encoding)Implements org. Write the contents of the given Properties object to the given XML OutputStream. |
| INSTANCE | back to summary |
|---|---|
| public static final DefaultPropertiesPersister INSTANCE A convenient constant for a default
| |
| DefaultPropertiesPersister | back to summary |
|---|---|
| public DefaultPropertiesPersister() | |
| load | back to summary |
|---|---|
| public void load(Properties props, InputStream is) throws IOException Implements org. Doc from org. Load properties from the given InputStream into the given Properties object.
| |
| load | back to summary |
|---|---|
| public void load(Properties props, Reader reader) throws IOException Implements org. Doc from org. Load properties from the given Reader into the given Properties object.
| |
| loadFromXml | back to summary |
|---|---|
| public void loadFromXml(Properties props, InputStream is) throws IOException Implements org. Doc from org. Load properties from the given XML InputStream into the given Properties object.
| |
| store | back to summary |
|---|---|
| public void store(Properties props, OutputStream os, String header) throws IOException Implements org. Doc from org. Write the contents of the given Properties object to the given OutputStream.
| |
| store | back to summary |
|---|---|
| public void store(Properties props, Writer writer, String header) throws IOException Implements org. Doc from org. Write the contents of the given Properties object to the given Writer.
| |
| storeToXml | back to summary |
|---|---|
| public void storeToXml(Properties props, OutputStream os, String header) throws IOException Implements org. Doc from org. Write the contents of the given Properties object to the given XML OutputStream.
| |
| storeToXml | back to summary |
|---|---|
| public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException Implements org. Doc from org. Write the contents of the given Properties object to the given XML OutputStream.
| |