| Constructor and Description |
|---|
JsonSaxWriter(OutputStream outputStream)
Creates a JsonSaxWriter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(String data) |
void |
completeBeforeElement(String tagName) |
void |
element(String name,
Object... attrs) |
void |
endDocument() |
void |
endElement() |
void |
endSequence()
Informs the writer that a sequence of elements of the same name has
ended.
|
void |
flush()
Flushes any unwritten output.
|
void |
startDocument() |
void |
startElement(String name) |
void |
startElement(String name,
Object... attrs) |
void |
startSequence(String name,
String subName)
Informs the writer that a sequence of elements of the same name is
starting.
|
void |
textElement(String name,
Object data)
Generates a text-only element,
<name>data</name>. |
void |
verbatim(String text)
Sends a piece of text verbatim through the writer.
|
public JsonSaxWriter(OutputStream outputStream)
outputStream - Output streampublic void startDocument()
startDocument in interface SaxWriterpublic void endDocument()
endDocument in interface SaxWriterpublic void startSequence(String name, String subName)
SaxWriterFor XML, is equivalent to startElement(name).
For JSON, initiates the array construct:
"name" : [
{ ... },
{ ... }
]startSequence in interface SaxWritername - Element namesubName - Child element namepublic void endSequence()
SaxWriterendSequence in interface SaxWriterpublic void startElement(String name)
startElement in interface SaxWriterpublic void startElement(String name, Object... attrs)
startElement in interface SaxWriterpublic void endElement()
endElement in interface SaxWriterpublic void characters(String data)
characters in interface SaxWriterpublic void textElement(String name, Object data)
SaxWriter<name>data</name>.
For XML, this is equivalent to
startElement(name);
characters(data);
endElement();
but for JSON, generates "name": "data".textElement in interface SaxWritername - Name of elementdata - Text content of elementpublic void completeBeforeElement(String tagName)
completeBeforeElement in interface SaxWriterpublic void verbatim(String text)
SaxWriter