Package org.apache.juneau.html
Class HtmlWriter
java.lang.Object
java.io.Writer
org.apache.juneau.serializer.SerializerWriter
org.apache.juneau.xml.XmlWriter
org.apache.juneau.html.HtmlWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
- Direct Known Subclasses:
SimpleHtmlWriter
Specialized writer for serializing HTML.
See Also:
-
Field Summary
Fields inherited from class org.apache.juneau.serializer.SerializerWriter
maxIndent, out, quoteChar, trimStrings, uriResolver, useWhitespace
-
Constructor Summary
ConstructorDescriptionHtmlWriter
(Writer out, boolean useWhitespace, int maxIndent, boolean trimStrings, 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 .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).Shortcut forattr(
null , name, value,false );Shortcut forattr(
null , name, value,false );Shortcut forattr(ns, name, value,
false );Writes an attribute to the output:ns:name ='value' cr
(int depth) Performs a carriage return.cre
(int depth) Performs a carriage return at the end of a line.Shortcut fori(indent).eTag(
null , name,false );Shortcut fori(indent).eTag(ns, name,
false );Shortcut fori(indent).eTag(ns, name, needsEncoding); Shortcut foreTag(
null , name,false );Shortcut foreTag(ns, name,
false );Writes an end tag to the output:</ns:name> 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.Writes an open-ended attribute to the output:ns:name =Shortcut fori(indent).oTag(
null , name,false );Shortcut fori(indent).oTag(ns, name,
false );Shortcut fori(indent).oTag(ns, name, needsEncoding); Shortcut foroTag(
null , name,false );Shortcut foroTag(ns, name,
false );Writes an opening tag to the output:<ns:name q()
Adds the quote character specified by thequoteChar
setting to the output.s()
Adds a whitespace character to the output if theuseWhitespace
setting is enabled.Shortcut fori(indent).sTag(
null , name,false );Shortcut fori(indent).sTag(ns, name,
false );Shortcut fori(indent).sTag(ns, name, needsEncoding); Shortcut forsTag(
null , name,false );Shortcut forsTag(ns, name,
false );Writes a start tag to the output:<ns:name> Shortcut fori(indent).tag(
null , name,false );Shortcut fori(indent).tag(ns, name,
false );Shortcut fori(indent).tag(ns, name, needsEncoding); Shortcut fortag(
null , name,false );Shortcut fortag(ns, name,
false );Writes a closed tag to the output:<ns:name/> Serializes and encodes the specified object as valid XML text.Methods inherited from class org.apache.juneau.xml.XmlWriter
attr, attrUri, attrUri, attrUri, ceTag, cTag, ie, oAttr, text, textUri, toString, w, w
-
Constructor Details
-
HtmlWriter
public HtmlWriter(Writer out, boolean useWhitespace, int maxIndent, boolean trimStrings, char quoteChar, UriResolver uriResolver) Constructor.- Parameters:
out
- The writer being wrapped.useWhitespace
- Iftrue , tabs will be used in output.maxIndent
- The maximum indentation level.trimStrings
- Iftrue , strings should be trimmed before they're serialized.quoteChar
- The quote character to use (i.e.'\'' or'"' )uriResolver
- The URI resolver for resolving URIs to absolute or root-relative form.
-
-
Method Details
-
text
Description copied from class:XmlWriter
Serializes and encodes the specified object as valid XML text.- Overrides:
text
in classXmlWriter
- Parameters:
o
- The object being serialized.preserveWhitespace
- Iftrue , then we're serializingXmlFormat.MIXED_PWS
orXmlFormat.TEXT_PWS
content.- Returns:
- This object.
-
oTag
Description copied from class:XmlWriter
Writes an opening tag to the output:<ns:name -
oTag
Description copied from class:XmlWriter
Shortcut foroTag(ns, name,
false ); -
oTag
Description copied from class:XmlWriter
Shortcut foroTag(
null , name,false ); -
oTag
Description copied from class:XmlWriter
Shortcut fori(indent).oTag(ns, name, needsEncoding); -
oTag
Description copied from class:XmlWriter
Shortcut fori(indent).oTag(ns, name,
false ); -
oTag
Description copied from class:XmlWriter
Shortcut fori(indent).oTag(
null , name,false ); -
tag
Description copied from class:XmlWriter
Writes a closed tag to the output:<ns:name/> -
tag
Description copied from class:XmlWriter
Shortcut fortag(ns, name,
false ); -
tag
Description copied from class:XmlWriter
Shortcut fortag(
null , name,false ); -
tag
Description copied from class:XmlWriter
Shortcut fori(indent).tag(
null , name,false ); -
tag
Description copied from class:XmlWriter
Shortcut fori(indent).tag(ns, name, needsEncoding); -
tag
Description copied from class:XmlWriter
Shortcut fori(indent).tag(ns, name,
false ); -
sTag
Description copied from class:XmlWriter
Shortcut forsTag(ns, name,
false ); -
sTag
Description copied from class:XmlWriter
Writes a start tag to the output:<ns:name> -
sTag
Description copied from class:XmlWriter
Shortcut fori(indent).sTag(ns, name,
false ); -
sTag
Description copied from class:XmlWriter
Shortcut fori(indent).sTag(
null , name,false ); -
sTag
Description copied from class:XmlWriter
Shortcut forsTag(
null , name,false ); -
sTag
Description copied from class:XmlWriter
Shortcut fori(indent).sTag(ns, name, needsEncoding); -
eTag
Description copied from class:XmlWriter
Shortcut foreTag(ns, name,
false ); -
eTag
Description copied from class:XmlWriter
Writes an end tag to the output:</ns:name> -
eTag
Description copied from class:XmlWriter
Shortcut fori(indent).eTag(ns, name,
false ); -
eTag
Description copied from class:XmlWriter
Shortcut fori(indent).eTag(
null , name,false ); -
eTag
Description copied from class:XmlWriter
Shortcut foreTag(
null , name,false ); -
eTag
Description copied from class:XmlWriter
Shortcut fori(indent).eTag(ns, name, needsEncoding); -
attr
Description copied from class:XmlWriter
Shortcut forattr(
null , name, value,false ); -
attr
Description copied from class:XmlWriter
Shortcut forattr(ns, name, value,
false ); -
attr
Description copied from class:XmlWriter
Writes an attribute to the output:ns:name ='value' -
attr
Description copied from class:XmlWriter
Shortcut forattr(
null , name, value,false ); -
oAttr
Description copied from class:XmlWriter
Writes an open-ended attribute to the output:ns:name = -
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. -
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. -
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). -
appendln
Description copied from class:SerializerWriter
Writes the specified text followed by a newline (if theuseWhitespace
setting is enabled). -
append
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text. -
append
Description copied from class:SerializerWriter
Writes an indent (if theuseWhitespace
setting is enabled), followed by text. -
s
Description copied from class:SerializerWriter
Adds a whitespace character to the output if theuseWhitespace
setting is enabled. -
q
Description copied from class:SerializerWriter
Adds the quote character specified by thequoteChar
setting to the output. -
i
Description copied from class:SerializerWriter
Writes an indent to the writer if theuseWhitespace
setting is enabled. -
nl
Description copied from class:SerializerWriter
Writes a newline to the writer if theuseWhitespace
setting is enabled. -
append
Description copied from class:SerializerWriter
Writes the specified text to the writer if it isn'tnull . -
append
Description copied from class:SerializerWriter
Writes the specified text to the writer if it isn'tnull . -
append
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classXmlWriter
-