public final class UonWriter extends SerializerWriter
maxIndent, out, quoteChar, trimStrings, uriResolver, useWhitespace
Modifier | Constructor and Description |
---|---|
protected |
UonWriter(UonSerializerSession session,
Writer out,
boolean useWhitespace,
int maxIndent,
boolean encodeChars,
boolean trimStrings,
boolean plainTextParams,
UriResolver uriResolver)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
UonWriter |
append(char c) |
UonWriter |
append(int indent,
char c)
Writes an indent (if the
useWhitespace setting is enabled), followed by text. |
UonWriter |
append(int indent,
String text)
Writes an indent (if the
useWhitespace setting is enabled), followed by text. |
UonWriter |
append(Object text)
Writes the specified text to the writer.
|
UonWriter |
append(String text)
Writes the specified text to the writer.
|
protected UonWriter |
appendBoolean(Object o)
Appends a boolean value to the output.
|
UonWriter |
appendIf(boolean b,
char c)
Writes the specified text to the writer if b is true.
|
UonWriter |
appendIf(boolean b,
String text)
Writes the specified text to the writer if b is true.
|
UonWriter |
appendln(int indent,
String text)
Writes an indent (if the
useWhitespace setting is enabled), followed by text, followed by a newline
(if the useWhitespace setting is enabled). |
UonWriter |
appendln(String text)
Writes the specified text followed by a newline (if the
useWhitespace setting is enabled). |
protected UonWriter |
appendNumber(Object o)
Appends a numeric value to the output.
|
UonWriter |
appendObject(Object o,
boolean isTopAttrName)
Serializes the specified simple object as a UON string value.
|
SerializerWriter |
appendUri(Object uri)
Appends a URI to the output.
|
UonWriter |
cr(int depth)
Performs a carriage return.
|
UonWriter |
cre(int depth)
Performs a carriage return at the end of a line.
|
UonWriter |
i(int indent)
Writes an indent to the writer if the
useWhitespace setting is enabled. |
UonWriter |
nl(int indent)
Writes a newline to the writer if the
useWhitespace setting is enabled. |
UonWriter |
q()
Adds the quote character specified by the
quoteChar setting to the output. |
protected UonWriter(UonSerializerSession session, Writer out, boolean useWhitespace, int maxIndent, boolean encodeChars, boolean trimStrings, boolean plainTextParams, UriResolver uriResolver)
session
- The session that created this writer.out
- The writer being wrapped.useWhitespace
- If maxIndent
- The maximum indentation level.encodeChars
- If trimStrings
- If plainTextParams
- If uriResolver
- The URI resolver for resolving URIs to absolute or root-relative form.public final UonWriter appendObject(Object o, boolean isTopAttrName) throws IOException
o
- The object being serialized.isTopAttrName
- If this is a top-level attribute name we're serializing.IOException
- Should never happen.protected UonWriter appendBoolean(Object o) throws IOException
o
- The boolean value to append to the output.IOException
- Thrown by underlying stream.protected UonWriter appendNumber(Object o) throws IOException
o
- The numeric value to append to the output.IOException
- Thrown by underlying stream.public SerializerWriter appendUri(Object uri) throws IOException
appendUri
in class SerializerWriter
uri
- The URI to append to the output.IOException
- Thrown by underlying stream.public UonWriter cr(int depth) throws IOException
SerializerWriter
Adds a newline and the specified number of tabs (if the useWhitespace
setting is enabled) to the output.
cr
in class SerializerWriter
depth
- The indentation.IOException
- If a problem occurred trying to write to the writer.public UonWriter cre(int depth) throws IOException
SerializerWriter
Adds a newline and the specified number of tabs (if the useWhitespace
setting is enabled) to the output.
cre
in class SerializerWriter
depth
- The indentation.IOException
- If a problem occurred trying to write to the writer.public UonWriter appendln(int indent, String text) throws IOException
SerializerWriter
useWhitespace
setting is enabled), followed by text, followed by a newline
(if the useWhitespace
setting is enabled).appendln
in class SerializerWriter
indent
- The number of tabs to indent.text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter appendln(String text) throws IOException
SerializerWriter
useWhitespace
setting is enabled).appendln
in class SerializerWriter
text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter append(int indent, String text) throws IOException
SerializerWriter
useWhitespace
setting is enabled), followed by text.append
in class SerializerWriter
indent
- The number of tabs to indent.text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter append(int indent, char c) throws IOException
SerializerWriter
useWhitespace
setting is enabled), followed by text.append
in class SerializerWriter
indent
- The number of tabs to indent.c
- The character to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter q() throws IOException
SerializerWriter
quoteChar
setting to the output.q
in class SerializerWriter
IOException
- If a problem occurred trying to write to the writer.public UonWriter i(int indent) throws IOException
SerializerWriter
useWhitespace
setting is enabled.i
in class SerializerWriter
indent
- The number of tabs to indent.IOException
- If a problem occurred trying to write to the writer.public UonWriter nl(int indent) throws IOException
SerializerWriter
useWhitespace
setting is enabled.nl
in class SerializerWriter
indent
- The current indentation level.IOException
- If a problem occurred trying to write to the writer.public UonWriter append(Object text) throws IOException
SerializerWriter
append
in class SerializerWriter
text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter append(String text) throws IOException
SerializerWriter
append
in class SerializerWriter
text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter appendIf(boolean b, String text) throws IOException
SerializerWriter
appendIf
in class SerializerWriter
b
- Boolean flag.text
- The text to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter appendIf(boolean b, char c) throws IOException
SerializerWriter
appendIf
in class SerializerWriter
b
- Boolean flag.c
- The text to write.IOException
- If a problem occurred trying to write to the writer.public UonWriter append(char c) throws IOException
append
in interface Appendable
append
in class SerializerWriter
IOException
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.