public static class PropertiesConfiguration.PropertiesWriter
extends java.io.FilterWriter
Modifier and Type | Field and Description |
---|---|
private char |
delimiter
The delimiter for multi-valued properties.
|
Constructor and Description |
---|
PropertiesConfiguration.PropertiesWriter(java.io.Writer writer,
char delimiter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
escapeKey(java.lang.String key)
Escape the separators in the key.
|
private java.lang.String |
escapeValue(java.lang.Object value)
Escapes the given property value.
|
private java.lang.String |
makeSingleLineValue(java.util.List values)
Transforms a list of values into a single line value.
|
void |
writeComment(java.lang.String comment)
Write a comment.
|
void |
writeln(java.lang.String s)
Helper method for writing a line with the platform specific line
ending.
|
void |
writeProperty(java.lang.String key,
java.util.List values)
Write a property.
|
void |
writeProperty(java.lang.String key,
java.lang.Object value)
Write a property.
|
void |
writeProperty(java.lang.String key,
java.lang.Object value,
boolean forceSingleLine)
Writes the given property and its value.
|
public PropertiesConfiguration.PropertiesWriter(java.io.Writer writer, char delimiter)
writer
- a Writer object providing the underlying streamdelimiter
- the delimiter character for multi-valued propertiespublic void writeProperty(java.lang.String key, java.lang.Object value) throws java.io.IOException
key
- the key of the propertyvalue
- the value of the propertyjava.io.IOException
- if an I/O error occurspublic void writeProperty(java.lang.String key, java.util.List values) throws java.io.IOException
key
- The key of the propertyvalues
- The array of values of the propertyjava.io.IOException
- if an I/O error occurspublic void writeProperty(java.lang.String key, java.lang.Object value, boolean forceSingleLine) throws java.io.IOException
forceSingleLine
flag is evaluated. If it is
set, all values are written on a single line using the list delimiter
as separator.key
- the property keyvalue
- the property valueforceSingleLine
- the "force single line" flagjava.io.IOException
- if an error occurspublic void writeComment(java.lang.String comment) throws java.io.IOException
comment
- the comment to writejava.io.IOException
- if an I/O error occursprivate java.lang.String escapeKey(java.lang.String key)
key
- the keyprivate java.lang.String escapeValue(java.lang.Object value)
value
- the property valueprivate java.lang.String makeSingleLineValue(java.util.List values)
values
- the list with the valuespublic void writeln(java.lang.String s) throws java.io.IOException
s
- the content of the line (may be null)java.io.IOException
- if an error occurs