public interface ResultReader
The result tree is traversed through a set of events by calling
next()
. Each event can trigger a state change which changes the set
of methods that can be called.
Available methods in a certain state
Event | Available methods |
---|---|
START_RESULTS |
next, hasNext |
END_RESULTS |
hasNext |
START_NODE |
next, hasNext, getName, getTypeName |
END_NODE |
next, hasNext |
RESULT |
next, hasNext, getName, getTypeName, getValue, getInt | getLong | getDouble | getString (depends on the result type) |
START_ARRAY |
next, hasNext, getName, getTypeName |
END_ARRAY |
next, hasNext | START_ELEMENT |
next, hasNext, getName, getTypeName, getIndex |
END_ELEMENT |
next, hasNext |
Modifier and Type | Interface and Description |
---|---|
static class |
ResultReader.Event
Read events which occur in a result file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the reader and underlying streams.
|
double |
getDouble()
Returns the current double result.
|
long |
getIndex()
Returns the index of the current result element.
|
long |
getLong()
Returns the current long integer result.
|
java.lang.String |
getName()
Returns the name of the current result.
|
java.lang.String |
getString()
Returns the current string result.
|
java.lang.String |
getTypeName()
Returns the type of the current result.
|
java.lang.String |
getValue()
Reads the unparsed value of the current result from the input.
|
boolean |
hasNext()
Returns whether any read events remain or the result tree has been fully
traversed.
|
ResultReader.Event |
next()
Returns the next result read event.
|
ResultReader.Event |
nextResult()
Reads the next result (item, node or array).
|
double |
readDouble(java.lang.String name)
Reads the next double result from the input.
|
void |
readEndArray()
Reads the end of the current result array.
|
void |
readEndArrayItem()
Reads the end of the current array element.
|
void |
readEndNode()
Reads the end of the current result node.
|
void |
readEndResults()
Reads the end of the result tree.
|
long |
readLong(java.lang.String name)
Reads the next long integer result from the input.
|
void |
readStartArray(java.lang.String expectedName)
Reads the next result array.
|
long |
readStartArrayItem(long expectedIndex)
Reads the next array element.
|
void |
readStartNode(java.lang.String expectedType,
java.lang.String expectedName)
Reads the next result node.
|
void |
readStartResults()
Reads the start of the result tree.
|
java.lang.String |
readString(java.lang.String name)
Reads the next string result from the input.
|
void close() throws ImportException
ImportException
ResultReader.Event next() throws ImportException
ImportException
ResultReader.Event nextResult() throws ImportException
ResultReader.Event.RESULT
, ResultReader.Event.START_NODE
or
ResultReader.Event.START_ARRAY
ImportException
boolean hasNext() throws ImportException
Calling next()
after this mehtod returned false
will
result in an exception.
ImportException
java.lang.String getName() throws ImportException
null
is returned.null
ImportException
java.lang.String getTypeName() throws ImportException
ImportException
long getIndex() throws ImportException
ImportException
java.lang.String getValue() throws ImportException
ImportException
void readStartResults() throws ImportException
ImportException
void readEndResults() throws ImportException
ImportException
void readStartArray(java.lang.String expectedName) throws ImportException
expectedName
- the expected nameImportException
void readEndArray() throws ImportException
ImportException
long readStartArrayItem(long expectedIndex) throws ImportException
expectedIndex
- the expected index (to be compared with the index read from the
result file)ImportException
void readEndArrayItem() throws ImportException
ImportException
void readStartNode(java.lang.String expectedType, java.lang.String expectedName) throws ImportException
expectedType
- the expected type nameexpectedName
- the expected nameImportException
void readEndNode() throws ImportException
ImportException
long getLong() throws ImportException
ImportException
long readLong(java.lang.String name) throws ImportException
nextResult(); getLong();
ImportException
double getDouble() throws ImportException
ImportException
double readDouble(java.lang.String name) throws ImportException
nextResult(); getDouble();
ImportException
java.lang.String getString() throws ImportException
ImportException
java.lang.String readString(java.lang.String name) throws ImportException
nextResult(); getString();
ImportException