public interface ResultWriter
Comments can be written anywhere to the result tree but might not be supported by implementations and are always skipped by result readers. They can however increase readability in certain cases.
Result names are optional.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the writer and underlying streams.
|
void |
writeDouble(java.lang.String name,
double value)
A shorthand method for
|
void |
writeEndArray()
Writes the end of a result array.
|
void |
writeEndArrayItem()
Writes the end of a result array bucket.
|
void |
writeEndNode()
Writes the end of a result node.
|
void |
writeEndResults()
Writes the end of the results.
|
void |
writeLong(java.lang.String name,
long value)
A shorthand method for
|
void |
writeStartArray(java.lang.String name)
Writes the beginning of a result array.
|
void |
writeStartArrayItem(int index)
Writes the beginning of a result array bucket.
|
void |
writeStartNode(java.lang.String type,
java.lang.String name)
Writes the beginning of a result node.
|
void |
writeStartResults()
Writes the beginning of the results.
|
void |
writeString(java.lang.String name,
java.lang.String value)
A shorthand method for
|
void close() throws ResultException
ResultException
void writeStartResults() throws ResultException
writeEndResults
.ResultException
- if any error in writing the results occursjava.lang.IllegalStateException
- if result output has started alreadyvoid writeEndResults() throws ResultException
writeStartResults
and all other
writeStartXXX
must have been matched by their
writeEndXXX
counterparts.ResultException
- if any error in writing the results occursjava.lang.IllegalStateException
- if any started result hasn't been ended yetvoid writeStartNode(java.lang.String type, java.lang.String name) throws ResultException
writeEndNode
.type
- of the result nodeResultException
- if any error in writing the results occursvoid writeEndNode() throws ResultException
writeStartNode
.ResultException
- if any error in writing the results occursvoid writeStartArray(java.lang.String name) throws ResultException
writeEndArray
.ResultException
- if any error in writing the results occursvoid writeEndArray() throws ResultException
writeStartArray
.ResultException
- if any error in writing the results occursvoid writeStartArrayItem(int index) throws ResultException
writeEndBucket
. It is only legal to call this method in an array.ResultException
- if any error in writing the results occursvoid writeEndArrayItem() throws ResultException
writeStartBucket
.ResultException
- if any error in writing the results occursvoid writeLong(java.lang.String name, long value) throws ResultException
<code> writeLong(value); writeName(name); </code>
name
- name of the resultvalue
- value of the resultResultException
- if any error in writing the results occursvoid writeDouble(java.lang.String name, double value) throws ResultException
<code> writeDouble(value); writeName(name); </code>
name
- name of the resultvalue
- value of the resultResultException
- if any error in writing the results occursvoid writeString(java.lang.String name, java.lang.String value) throws ResultException
<code> writeString(value); writeName(name); </code>
name
- name of the resultvalue
- value of the resultResultException
- if any error in writing the results occurs