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
ImportExceptionResultReader.Event next() throws ImportException
ImportExceptionResultReader.Event nextResult() throws ImportException
ResultReader.Event.RESULT, ResultReader.Event.START_NODE or
ResultReader.Event.START_ARRAYImportExceptionboolean hasNext()
throws ImportException
Calling next() after this mehtod returned false will
result in an exception.
ImportExceptionjava.lang.String getName()
throws ImportException
null is returned.nullImportExceptionjava.lang.String getTypeName()
throws ImportException
ImportExceptionlong getIndex()
throws ImportException
ImportExceptionjava.lang.String getValue()
throws ImportException
ImportExceptionvoid readStartResults()
throws ImportException
ImportExceptionvoid readEndResults()
throws ImportException
ImportExceptionvoid readStartArray(java.lang.String expectedName)
throws ImportException
expectedName - the expected nameImportExceptionvoid readEndArray()
throws ImportException
ImportExceptionlong readStartArrayItem(long expectedIndex)
throws ImportException
expectedIndex - the expected index (to be compared with the index read from the
result file)ImportExceptionvoid readEndArrayItem()
throws ImportException
ImportExceptionvoid readStartNode(java.lang.String expectedType,
java.lang.String expectedName)
throws ImportException
expectedType - the expected type nameexpectedName - the expected nameImportExceptionvoid readEndNode()
throws ImportException
ImportExceptionlong getLong()
throws ImportException
ImportExceptionlong readLong(java.lang.String name)
throws ImportException
nextResult(); getLong();
ImportExceptiondouble getDouble()
throws ImportException
ImportExceptiondouble readDouble(java.lang.String name)
throws ImportException
nextResult(); getDouble();
ImportExceptionjava.lang.String getString()
throws ImportException
ImportExceptionjava.lang.String readString(java.lang.String name)
throws ImportException
nextResult(); getString();
ImportException