public class OutputAdapter extends Object
Output the properties to various data sinks and in various formats.
| Modifier and Type | Field and Description |
|---|---|
(package private) static String |
lineSeparator |
(package private) Properties |
properties |
| Constructor and Description |
|---|
OutputAdapter(Properties properties) |
| Modifier and Type | Method and Description |
|---|---|
static String |
toString(Properties props) |
protected void |
visit(Node node,
int level,
NodeVisitor func) |
void |
writeAsciiTo(File file)
This is specifically intended for compatibility with java.util.Properties, which outputs in ISO-8859-1 (US-ASCII)
|
void |
writeAsciiTo(File file,
OutputFormat format)
This is specifically intended for compatibility with java.util.Properties, which outputs in ISO-8859-1 (US-ASCII)
Use AsciiOutputFormat to get unicode escapes or an output format with similar filtering.
|
void |
writeAsXml(Writer out)
The output from this method is designed to be read back in using
Properties.Factory.getInstanceFromXML(File).
|
void |
writeTo(File file) |
void |
writeTo(File file,
OutputFormat format) |
void |
writeTo(File file,
OutputFormat format,
Charset charset)
Use to control the format of the output.
|
void |
writeTo(OutputStream out,
OutputFormat format,
Charset charset)
Use to control the format of the output.
|
void |
writeTo(Writer writer) |
void |
writeTo(Writer writer,
OutputFormat format) |
final Properties properties
static final String lineSeparator
public OutputAdapter(Properties properties)
public void writeTo(File file)
public void writeTo(File file, OutputFormat format)
public void writeTo(OutputStream out, OutputFormat format, Charset charset)
file - format - charset - public void writeTo(File file, OutputFormat format, Charset charset)
file - format - charset - public void writeAsciiTo(File file, OutputFormat format)
file - format - charset - public void writeAsciiTo(File file)
file - format - charset - public void writeTo(Writer writer, OutputFormat format) throws IOException
IOExceptionpublic void writeTo(Writer writer) throws IOException
IOExceptionpublic void writeAsXml(Writer out)
The output from this method is designed to be read back in using Properties.Factory.getInstanceFromXML(File). It is expected to fail if any nodes are not suitable for xml elements. For example, the following property keys will not work in that they end with tokens not usable as xml elements: a.b.c.1=value a.b.c.xml=value a.b.c.@$=value If these are identified, the method will fail with a RuntimeException If Properties.Factory.mode == Mode.Compatibility, then we emit ISO-8859-1 as the encoding. Otherwise, we emit UTF-8 as the encoding Note, this method does NOT close the writer
out - protected void visit(Node node, int level, NodeVisitor func)
public static final String toString(Properties props)
Copyright © 2011-2014 David R. Smith. All Rights Reserved.