public class XMLResultReader extends java.lang.Object implements ResultReader
ResultReader.Event
Constructor and Description |
---|
XMLResultReader(java.io.InputStream input,
java.lang.String fileNameForErrorMessages) |
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 expectedName)
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 expectedName)
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 expectedName)
Reads the next string result from the input.
|
public XMLResultReader(java.io.InputStream input, java.lang.String fileNameForErrorMessages) throws ImportException
ImportException
public void close() throws ImportException
ResultReader
close
in interface ResultReader
ImportException
public double getDouble() throws ImportException
ResultReader
getDouble
in interface ResultReader
ImportException
public long getIndex() throws ImportException
ResultReader
getIndex
in interface ResultReader
ImportException
public long getLong() throws ImportException
ResultReader
getLong
in interface ResultReader
ImportException
public java.lang.String getName() throws ImportException
ResultReader
null
is returned.getName
in interface ResultReader
null
ImportException
public java.lang.String getString() throws ImportException
ResultReader
getString
in interface ResultReader
ImportException
public java.lang.String getTypeName() throws ImportException
ResultReader
getTypeName
in interface ResultReader
ImportException
public java.lang.String getValue() throws ImportException
ResultReader
getValue
in interface ResultReader
ImportException
public boolean hasNext()
ResultReader
Calling ResultReader.next()
after this mehtod returned false
will
result in an exception.
hasNext
in interface ResultReader
public ResultReader.Event next() throws ImportException
ResultReader
next
in interface ResultReader
ImportException
public void readStartResults() throws ImportException
ResultReader
readStartResults
in interface ResultReader
ImportException
public void readEndResults() throws ImportException
ResultReader
readEndResults
in interface ResultReader
ImportException
public void readEndArrayItem() throws ImportException
ResultReader
readEndArrayItem
in interface ResultReader
ImportException
public void readEndNode() throws ImportException
ResultReader
readEndNode
in interface ResultReader
ImportException
public void readStartNode(java.lang.String expectedType, java.lang.String expectedName) throws ImportException
ResultReader
readStartNode
in interface ResultReader
expectedType
- the expected type nameexpectedName
- the expected nameImportException
public void readEndArray() throws ImportException
ResultReader
readEndArray
in interface ResultReader
ImportException
public void readStartArray(java.lang.String expectedName) throws ImportException
ResultReader
readStartArray
in interface ResultReader
expectedName
- the expected nameImportException
public ResultReader.Event nextResult() throws ImportException
ResultReader
nextResult
in interface ResultReader
ResultReader.Event.RESULT
, ResultReader.Event.START_NODE
or
ResultReader.Event.START_ARRAY
ImportException
public long readStartArrayItem(long expectedIndex) throws ImportException
ResultReader
readStartArrayItem
in interface ResultReader
expectedIndex
- the expected index (to be compared with the index read from the
result file)ImportException
public double readDouble(java.lang.String expectedName) throws ImportException
ResultReader
nextResult(); getDouble();
readDouble
in interface ResultReader
ImportException
public long readLong(java.lang.String expectedName) throws ImportException
ResultReader
nextResult(); getLong();
readLong
in interface ResultReader
ImportException
public java.lang.String readString(java.lang.String expectedName) throws ImportException
ResultReader
nextResult(); getString();
readString
in interface ResultReader
ImportException