Class SimpleHtmlWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Example:
String
See Also:
-
Field Summary
Fields inherited from class org.apache.juneau.serializer.SerializerWriter
maxIndent, out, quoteChar, trimStrings, uriResolver, useWhitespace -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(char[] value) Appends the specified characters to this writer.append(int indent, char c) Writes an indent (if theuseWhitespacesetting is enabled), followed by text.Writes an indent (if theuseWhitespacesetting 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 .appendIf(boolean flag, char value) 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 theuseWhitespacesetting is enabled), followed by text, followed by a newline (if theuseWhitespacesetting is enabled).Writes the specified text followed by a newline (if theuseWhitespacesetting is enabled).Appends the specified object as a URI.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' Append an attribute with a URI value.ceTag()Closes an empty tag.cr(int depth) Performs a carriage return.cre(int depth) Performs a carriage return at the end of a line.cTag()Closes a tag.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 theuseWhitespacesetting is enabled.ie(int indent) Writes an end-of-line indent to the writer if theuseWhitespacesetting is enabled.nl(int indent) Writes a newline to the writer if theuseWhitespacesetting is enabled.nlIf(boolean flag, int indent) Writes a newline to the writer if theuseWhitespacesetting is enabled and the boolean flag is true.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 thequoteCharsetting to the output.s()Adds a whitespace character to the output if theuseWhitespacesetting is enabled.sIf(boolean flag) Writes a space if the boolean expression istrue anduseWhitespaceis false.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/> Shortcut for callingtext(o,false );Serializes and encodes the specified object as valid XML text.Same asXmlWriter.text(Object)but treats the value as a URL to resolved then serialized.toString()w(char c) Writes the specified character to the writer.Writes the specified string to the writer.Methods inherited from class org.apache.juneau.serializer.SerializerWriter
close, flush, write
-
Constructor Details
-
SimpleHtmlWriter
public SimpleHtmlWriter()Constructor.
-
-
Method Details
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classHtmlWriter
-
append
Description copied from class:SerializerWriterAppends the specified characters to this writer.- Overrides:
appendin classHtmlWriter- Parameters:
value- The characters to append to this writer.- Returns:
- This object.
-
append
Description copied from class:SerializerWriterWrites an indent (if theuseWhitespacesetting is enabled), followed by text.- Overrides:
appendin classHtmlWriter- Parameters:
indent- The number of tabs to indent.c- The character to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriterWrites an indent (if theuseWhitespacesetting is enabled), followed by text.- Overrides:
appendin classHtmlWriter- Parameters:
indent- The number of tabs to indent.text- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriterWrites the specified text to the writer if it isn'tnull .- Overrides:
appendin classHtmlWriter- Parameters:
text- The text to write.- Returns:
- This object.
-
append
Description copied from class:SerializerWriterWrites the specified text to the writer if it isn'tnull .- Overrides:
appendin classHtmlWriter- Parameters:
text- The text to write.- Returns:
- This object.
-
appendIf
Description copied from class:SerializerWriterWrites the specified text to the writer if b is true.- Overrides:
appendIfin classHtmlWriter- Parameters:
flag- Boolean flag.value- The text to write.- Returns:
- This object.
-
appendIf
Description copied from class:SerializerWriterWrites the specified text to the writer if b is true.- Overrides:
appendIfin classHtmlWriter- Parameters:
flag- Boolean flag.value- The text to write.- Returns:
- This object.
-
appendln
Description copied from class:SerializerWriterWrites an indent (if theuseWhitespacesetting is enabled), followed by text, followed by a newline (if theuseWhitespacesetting is enabled).- Overrides:
appendlnin classHtmlWriter- Parameters:
indent- The number of tabs to indent.text- The text to write.- Returns:
- This object.
-
appendln
Description copied from class:SerializerWriterWrites the specified text followed by a newline (if theuseWhitespacesetting is enabled).- Overrides:
appendlnin classHtmlWriter- Parameters:
text- The text to write.- Returns:
- This object.
-
appendUri
Description copied from class:SerializerWriterAppends the specified object as a URI.Object is converted to a
String usingtoString() , so this will work onURLorURIobjects, or any other type that returns a URI via it'stoString() method.The URI is resolved based on the
Serializer.Builder.uriRelativity(UriRelativity)andSerializer.Builder.uriResolution(UriResolution)settings and theUriContextthat's part of the session.- Overrides:
appendUriin classHtmlWriter- Parameters:
value- The URI to serialize.- Returns:
- This object.
-
attr
Description copied from class:XmlWriterShortcut forattr(null , name, value,false );- Overrides:
attrin classHtmlWriter- Parameters:
name- The attribute name.value- The attribute value.- Returns:
- This object.
-
attr
Description copied from class:XmlWriterShortcut forattr(null , name, value,false );- Overrides:
attrin classHtmlWriter- Parameters:
name- The attribute name.value- The attribute value.valNeedsEncoding- Iftrue , attribute name will be encoded.- Returns:
- This object.
-
attr
Description copied from class:XmlWriterShortcut forattr(ns, name, value,false );- Overrides:
attrin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The attribute name.value- The attribute value.- Returns:
- This object.
-
attr
Description copied from class:XmlWriterWrites an attribute to the output:ns:name ='value' - Overrides:
attrin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The attribute name.value- The attribute value.valNeedsEncoding- Iftrue , attribute name will be encoded.- Returns:
- This object.
-
attrUri
Description copied from class:XmlWriterAppend an attribute with a URI value.- Overrides:
attrUriin classHtmlWriter- Parameters:
name- The attribute name.value- The attribute value. Can be any object whosetoString() method returns a URI.- Returns:
- This object.
-
ceTag
Description copied from class:XmlWriterCloses an empty tag.Shortcut for
append('/' ).append('->' );- Overrides:
ceTagin classHtmlWriter- Returns:
- This object.
-
cr
Description copied from class:SerializerWriterPerforms a carriage return.Adds a newline and the specified number of tabs (if the
useWhitespacesetting is enabled) to the output.- Overrides:
crin classHtmlWriter- Parameters:
depth- The indentation.- Returns:
- This object.
-
cre
Description copied from class:SerializerWriterPerforms a carriage return at the end of a line.Adds a newline and the specified number of tabs (if the
useWhitespacesetting is enabled) to the output.- Overrides:
crein classHtmlWriter- Parameters:
depth- The indentation.- Returns:
- This object.
-
cTag
Description copied from class:XmlWriterCloses a tag.Shortcut for
append('->' );- Overrides:
cTagin classHtmlWriter- Returns:
- This object.
-
eTag
Description copied from class:XmlWriterShortcut fori(indent).eTag(null , name,false );- Overrides:
eTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.name- The element name.- Returns:
- This object.
-
eTag
Description copied from class:XmlWriterShortcut fori(indent).eTag(ns, name,false );- Overrides:
eTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
eTag
Description copied from class:XmlWriterShortcut fori(indent).eTag(ns, name, needsEncoding); - Overrides:
eTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
eTag
Description copied from class:XmlWriterShortcut foreTag(null , name,false );- Overrides:
eTagin classHtmlWriter- Parameters:
name- The element name.- Returns:
- This object.
-
eTag
Description copied from class:XmlWriterShortcut foreTag(ns, name,false );- Overrides:
eTagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
eTag
Description copied from class:XmlWriterWrites an end tag to the output:</ns:name> - Overrides:
eTagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
i
Description copied from class:SerializerWriterWrites an indent to the writer if theuseWhitespacesetting is enabled.- Overrides:
iin classHtmlWriter- Parameters:
indent- The number of tabs to indent.- Returns:
- This object.
-
ie
Description copied from class:SerializerWriterWrites an end-of-line indent to the writer if theuseWhitespacesetting is enabled.- Overrides:
iein classHtmlWriter- Parameters:
indent- The number of tabs to indent.- Returns:
- This object.
-
nl
Description copied from class:SerializerWriterWrites a newline to the writer if theuseWhitespacesetting is enabled.- Overrides:
nlin classHtmlWriter- Parameters:
indent- The current indentation level.- Returns:
- This object.
-
nlIf
Description copied from class:SerializerWriterWrites a newline to the writer if theuseWhitespacesetting is enabled and the boolean flag is true.- Overrides:
nlIfin classHtmlWriter- Parameters:
flag- The boolean flag.indent- The current indentation level.- Returns:
- This object.
-
oAttr
Description copied from class:XmlWriterWrites an open-ended attribute to the output:ns:name =- Overrides:
oAttrin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The attribute name.- Returns:
- This object.
-
oTag
Description copied from class:XmlWriterShortcut fori(indent).oTag(null , name,false );- Overrides:
oTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.name- The element name.- Returns:
- This object.
-
oTag
Description copied from class:XmlWriterShortcut fori(indent).oTag(ns, name,false );- Overrides:
oTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
oTag
Description copied from class:XmlWriterShortcut fori(indent).oTag(ns, name, needsEncoding); - Overrides:
oTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
oTag
Description copied from class:XmlWriterShortcut foroTag(null , name,false );- Overrides:
oTagin classHtmlWriter- Parameters:
name- The element name.- Returns:
- This object.
-
oTag
Description copied from class:XmlWriterShortcut foroTag(ns, name,false );- Overrides:
oTagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
oTag
Description copied from class:XmlWriterWrites an opening tag to the output:<ns:name - Overrides:
oTagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
q
Description copied from class:SerializerWriterAdds the quote character specified by thequoteCharsetting to the output.- Overrides:
qin classHtmlWriter- Returns:
- This object.
-
s
Description copied from class:SerializerWriterAdds a whitespace character to the output if theuseWhitespacesetting is enabled.- Overrides:
sin classHtmlWriter- Returns:
- This object.
-
sIf
Description copied from class:SerializerWriterWrites a space if the boolean expression istrue anduseWhitespaceis false.Intended for cases in XML where text should be separated by either a space or newline. This ensures the text is separated by a space if whitespace is disabled.
- Overrides:
sIfin classHtmlWriter- Parameters:
flag- The boolean flag.- Returns:
- This object.
-
sTag
Description copied from class:XmlWriterShortcut fori(indent).sTag(null , name,false );- Overrides:
sTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.name- The element name.- Returns:
- This object.
-
sTag
Description copied from class:XmlWriterShortcut fori(indent).sTag(ns, name,false );- Overrides:
sTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
sTag
Description copied from class:XmlWriterShortcut fori(indent).sTag(ns, name, needsEncoding); - Overrides:
sTagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
sTag
Description copied from class:XmlWriterShortcut forsTag(null , name,false );- Overrides:
sTagin classHtmlWriter- Parameters:
name- The element name.- Returns:
- This object.
-
sTag
Description copied from class:XmlWriterShortcut forsTag(ns, name,false );- Overrides:
sTagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
sTag
Description copied from class:XmlWriterWrites a start tag to the output:<ns:name> - Overrides:
sTagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
tag
Description copied from class:XmlWriterShortcut fori(indent).tag(null , name,false );- Overrides:
tagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.name- The element name.- Returns:
- This object.
-
tag
Description copied from class:XmlWriterShortcut fori(indent).tag(ns, name,false );- Overrides:
tagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
tag
Description copied from class:XmlWriterShortcut fori(indent).tag(ns, name, needsEncoding); - Overrides:
tagin classHtmlWriter- Parameters:
indent- The number of prefix tabs to add.ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
tag
Description copied from class:XmlWriterShortcut fortag(null , name,false );- Overrides:
tagin classHtmlWriter- Parameters:
name- The element name.- Returns:
- This object.
-
tag
Description copied from class:XmlWriterShortcut fortag(ns, name,false );- Overrides:
tagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.- Returns:
- This object.
-
tag
Description copied from class:XmlWriterWrites a closed tag to the output:<ns:name/> - Overrides:
tagin classHtmlWriter- Parameters:
ns- The namespace. Can benull .name- The element name.needsEncoding- Iftrue , element name will be encoded.- Returns:
- This object.
-
text
Description copied from class:XmlWriterShortcut for callingtext(o,false );- Overrides:
textin classHtmlWriter- Parameters:
value- The object being serialized.- Returns:
- This object.
-
text
Description copied from class:XmlWriterSerializes and encodes the specified object as valid XML text.- Overrides:
textin classHtmlWriter- Parameters:
o- The object being serialized.preserveWhitespace- Iftrue , then we're serializingXmlFormat.MIXED_PWSorXmlFormat.TEXT_PWScontent.- Returns:
- This object.
-
textUri
Description copied from class:XmlWriterSame asXmlWriter.text(Object)but treats the value as a URL to resolved then serialized.- Overrides:
textUriin classHtmlWriter- Parameters:
value- The object being serialized.- Returns:
- This object.
-
toString
-
w
Description copied from class:SerializerWriterWrites the specified character to the writer.- Overrides:
win classHtmlWriter- Parameters:
c- The character to write.- Returns:
- This object.
-
w
Description copied from class:SerializerWriterWrites the specified string to the writer.- Overrides:
win classHtmlWriter- Parameters:
s- The string to write.- Returns:
- This object.
-