public class OutputAdapter extends Object
| Modifier and Type | Field and Description |
|---|---|
(package private) Properties |
props |
| Constructor and Description |
|---|
OutputAdapter(Properties properties) |
| Modifier and Type | Method and Description |
|---|---|
static String |
toJSON(Properties props)
Simple JSON formatting, emits the properties as an ordered, flattened JSON object.
|
static String |
toJSON(Properties props,
WriterConfig config)
Simple JSON formatting, emits the properties as an ordered, flattened JSON object
where you control the output format.
|
static String |
toString(Properties props)
Write properties in a default manner to a String.
|
static String |
toXML(Properties props)
Write out a legacy Sun DTD-compatible XML-formatted string representation of the properties.
|
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 method is specifically intended for compatibility with java.util.Properties,
which outputs in ISO-8859-1 (US-ASCII)
|
void |
writeAsciiTo(Writer writer)
This is specifically intended for compatibility with java.util.Properties,
which outputs in ISO-8859-1 (US-ASCII) with escapes
|
void |
writeTo(File file,
Charset charset)
Write to a file using a PlainOutputFormat.
|
void |
writeTo(File file,
OutputFormat format,
Charset charset)
Use to control the format of the output to a file.
|
void |
writeTo(OutputStream out,
OutputFormat format,
Charset charset)
Use to control the format of the output to a stream.
|
void |
writeTo(Writer writer)
Same as above but with a PlainOutputFormat
|
void |
writeTo(Writer writer,
OutputFormat format) |
final Properties props
public OutputAdapter(Properties properties)
public void writeTo(OutputStream out, OutputFormat format, Charset charset)
public void writeTo(File file, OutputFormat format, Charset charset)
public void writeTo(File file, Charset charset)
file - charset - public void writeAsciiTo(File file, OutputFormat format)
This method 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, as escapes are required for compatibility.
public void writeAsciiTo(File file)
public void writeAsciiTo(Writer writer)
public void writeTo(Writer writer, OutputFormat format) throws IOException
IOExceptionpublic void writeTo(Writer writer) throws IOException
writer - IOExceptionpublic static final String toString(Properties props)
props - public static final String toXML(Properties props)
props - public static final String toJSON(Properties props)
props - public static final String toJSON(Properties props, WriterConfig config)
props - WriterConfig - can be either WriterConfig.PRETTY_PRINT or WriterConfig.MINIMAL.Copyright © 2011–2018 David R. Smith. All rights reserved.