Package org.apache.juneau.uon
Class UonWriter
java.lang.Object
java.io.Writer
org.apache.juneau.serializer.SerializerWriter
org.apache.juneau.uon.UonWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
Specialized writer for serializing UON-encoded text.
Notes:
- This class is not intended for external use.
See Also:
-
Field Summary
Fields inherited from class org.apache.juneau.serializer.SerializerWriter
maxIndent, out, trimStrings, uriResolver, useWhitespace
-
Constructor Summary
ModifierConstructorDescriptionprotected
UonWriter
(UonSerializerSession session, Writer out, boolean useWhitespace, int maxIndent, boolean encodeChars, boolean trimStrings, boolean plainTextParams, char quoteChar, UriResolver uriResolver) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionappend
(char c) append
(int indent, char c) Writes an indent (if theuseWhitespace
setting is enabled), followed by text.Writes an indent (if theuseWhitespace
setting is enabled), followed by text.Writes the specified text to the writer if it isn'tnull .Writes the specified text to the writer if it isn'tnull .protected UonWriter
Appends a boolean value to the output.appendIf
(boolean b, char c) Writes the specified text to the writer if b is true.Writes the specified text to the writer if b is true.Writes an indent (if theuseWhitespace
setting is enabled), followed by text, followed by a newline (if theuseWhitespace
setting is enabled).Writes the specified text followed by a newline (if theuseWhitespace
setting is enabled).protected UonWriter
Appends a numeric value to the output.appendObject
(Object o, boolean isTopAttrName) Serializes the specified simple object as a UON string value.Appends a URI to the output.cr
(int depth) Performs a carriage return.cre
(int depth) Performs a carriage return at the end of a line.i
(int indent) Writes an indent to the writer if theuseWhitespace
setting is enabled.nl
(int indent) Writes a newline to the writer if theuseWhitespace
setting is enabled.q()
Adds the quote character specified by thequoteChar
setting to the output.
-
Constructor Details
-
UonWriter
protected UonWriter(UonSerializerSession session, Writer out, boolean useWhitespace, int maxIndent, boolean encodeChars, boolean trimStrings, boolean plainTextParams, char quoteChar, UriResolver uriResolver) Constructor.- Parameters:
session
- The session that created this writer.out
- The writer being wrapped.useWhitespace
- Iftrue , tabs will be used in output.maxIndent
- The maximum indentation level.encodeChars
- Iftrue , special characters should be encoded.trimStrings
- Iftrue , strings should be trimmed before they're serialized.plainTextParams
- Iftrue , don't use UON notation for values.quoteChar
- The quote character to use. If0 , defaults to'\'' .uriResolver
- The URI resolver for resolving URIs to absolute or root-relative form.
-
-
Method Details
-
appendObject
Serializes the specified simple object as a UON string value.- Parameters:
o
- The object being serialized.isTopAttrName
- If this is a top-level attribute name we're serializing.- Returns:
- This object.
-
appendBoolean
Appends a boolean value to the output.- Parameters:
o
- The boolean value to append to the output.- Returns:
- This object.
-
appendNumber
Appends a numeric value to the output.- Parameters:
o
- The numeric value to append to the output.- Returns:
- This object.
-
appendUri
Appends a URI to the output.- Overrides:
appendUri
in classSerializerWriter
- Parameters:
uri
- The URI to append to the output.- Returns:
- This object.
-
cr
Description copied from class:SerializerWriter
Performs a carriage return.Adds a newline and the specified number of tabs (if the
useWhitespace
setting is enabled) to the output.- Overrides:
cr
in classSerializerWriter
- Parameters:
depth
- The indentation.- Returns:
- This object.
-
cre
Description copied from class:SerializerWriter
Performs a carriage return at the end of a line.Adds a newline and the specified number of tabs (if the
useWhitespace
setting is enabled) to the output.- Overrides:
cre
in classSerializerWriter
- Parameters:
depth
- The indentation.- Returns:
- This object.
-
appendln
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text, followed by a newline (if theuseWhitespace
setting is enabled).- Overrides:
appendln
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.text
- The text to write.- Returns:
- This object.
-
appendln
Description copied from class:SerializerWriter
Writes the specified text followed by a newline (if theuseWhitespace
setting is enabled).- Overrides:
appendln
in classSerializerWriter
- Parameters:
text
- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text.- Overrides:
append
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.text
- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text.- Overrides:
append
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.c
- The character to write.- Returns:
- This object.
-
q
Description copied from class:SerializerWriter
Adds the quote character specified by thequoteChar
setting to the output.- Overrides:
q
in classSerializerWriter
- Returns:
- This object.
-
i
Description copied from class:SerializerWriter
Writes an indent to the writer if theuseWhitespace
setting is enabled.- Overrides:
i
in classSerializerWriter
- Parameters:
indent
- The number of tabs to indent.- Returns:
- This object.
-
nl
Description copied from class:SerializerWriter
Writes a newline to the writer if theuseWhitespace
setting is enabled.- Overrides:
nl
in classSerializerWriter
- Parameters:
indent
- The current indentation level.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes the specified text to the writer if it isn'tnull .- Overrides:
append
in classSerializerWriter
- Parameters:
text
- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriter
Writes the specified text to the writer if it isn'tnull .- Overrides:
append
in classSerializerWriter
- Parameters:
text
- The text to write.- Returns:
- This object.
-
appendIf
Description copied from class:SerializerWriter
Writes the specified text to the writer if b is true.- Overrides:
appendIf
in classSerializerWriter
- Parameters:
b
- Boolean flag.text
- The text to write.- Returns:
- This object.
-
appendIf
Description copied from class:SerializerWriter
Writes the specified text to the writer if b is true.- Overrides:
appendIf
in classSerializerWriter
- Parameters:
b
- Boolean flag.c
- The text to write.- Returns:
- This object.
-
append
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classSerializerWriter
-