@NotThreadSafe public class HtmlStreamRenderer extends Object implements HtmlStreamEventReceiver
writeOpenTag("plaintext", ...)
, then any tags in the second will not
be interpreted as tags in the concatenated version.Modifier and Type | Method and Description |
---|---|
void |
closeDocument() |
void |
closeTag(String elementName) |
static HtmlStreamRenderer |
create(Appendable output,
Handler<? super IOException> ioExHandler,
Handler<? super String> badHtmlHandler)
Factory.
|
static HtmlStreamRenderer |
create(StringBuilder output,
Handler<? super String> badHtmlHandler)
Factory.
|
boolean |
isDocumentOpen() |
void |
openDocument() |
void |
openTag(String elementName,
List<String> attrs) |
void |
text(String text) |
public static HtmlStreamRenderer create(@WillCloseWhenClosed Appendable output, Handler<? super IOException> ioExHandler, Handler<? super String> badHtmlHandler)
output
- the buffer to which HTML is streamed.ioExHandler
- called with any exception raised by output.badHtmlHandler
- receives alerts when HTML cannot be rendered because
there is not valid HTML tree that results from that series of calls.
E.g. it is not possible to create an HTML <style>
element whose
textual content is "</style>"
.public static HtmlStreamRenderer create(StringBuilder output, Handler<? super String> badHtmlHandler)
output
- the buffer to which HTML is streamed.badHtmlHandler
- receives alerts when HTML cannot be rendered because
there is not valid HTML tree that results from that series of calls.
E.g. it is not possible to create an HTML <style>
element whose
textual content is "</style>"
.public final void openDocument() throws IllegalStateException
openDocument
in interface HtmlStreamEventReceiver
IllegalStateException
public final void closeDocument() throws IllegalStateException
closeDocument
in interface HtmlStreamEventReceiver
IllegalStateException
public final boolean isDocumentOpen()
public final void openTag(String elementName, List<String> attrs)
openTag
in interface HtmlStreamEventReceiver
attrs
- alternating attribute names and values.public final void closeTag(String elementName)
closeTag
in interface HtmlStreamEventReceiver
public final void text(String text)
text
in interface HtmlStreamEventReceiver
Copyright © 2015. All rights reserved.