protected static class VOTableIterator.StreamVOTableSink
extends java.lang.Object
implements uk.ac.starlink.table.TableSink
This class lets consume the metadata and rows of a VOTable document.
On the contrary to a usual TableSink, this one will stop after each row until this row has been fetched by VOTableIterator.
Besides, the metadata returned by StarTable are immediately converted into TAP metadata. If this conversion fails, the error is kept
in metaError, so that the VOTable reading can continue if the fact that metadata are missing is not a problem for the class using the
VOTableIterator.
| Modifier | Constructor and Description |
|---|---|
protected |
StreamVOTableSink() |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptMetadata(uk.ac.starlink.table.StarTable metaTable) |
void |
acceptRow(java.lang.Object[] row) |
void |
endRows() |
protected TAPColumn[] |
extractColMeta(uk.ac.starlink.table.StarTable table)
Extract an array of
TAPColumn objects. |
protected java.lang.String |
getAuxDatumValue(uk.ac.starlink.table.ColumnInfo colInfo,
java.lang.String auxDatumName)
Extract the specified auxiliary datum value from the given
ColumnInfo. |
TAPColumn[] |
getMeta()
Get the metadata found in the VOTable.
|
java.lang.Object[] |
getRow()
Get the last accepted row.
|
void |
stop()
Stop nicely reading the VOTable.
|
void |
stop(java.lang.Throwable reason)
Stop nicely reading the VOTable.
|
public void stop()
Stop nicely reading the VOTable.
An exception will be thrown to the STILTS class using this TableSink, but no exception should be thrown to VOTableIterator.
public void stop(java.lang.Throwable reason)
Stop nicely reading the VOTable.
An exception will be thrown to the STILTS class using this TableSink, but no exception should be thrown to VOTableIterator.
reason - Reason why this Sink should be stop.
This should be used in case of external grave error that
should be raised when trying to access data through
VOTableIterator.
Example: a wrong VOTable format.public void acceptMetadata(uk.ac.starlink.table.StarTable metaTable)
throws uk.ac.starlink.table.TableFormatException
acceptMetadata in interface uk.ac.starlink.table.TableSinkuk.ac.starlink.table.TableFormatExceptionpublic void acceptRow(java.lang.Object[] row)
throws java.io.IOException
acceptRow in interface uk.ac.starlink.table.TableSinkjava.io.IOExceptionpublic void endRows()
throws java.io.IOException
endRows in interface uk.ac.starlink.table.TableSinkjava.io.IOExceptionpublic TAPColumn[] getMeta() throws DataReadException
Get the metadata found in the VOTable.
Note: This method is blocking until metadata are fully available by this TableSink or if an error occurred while converting them in TAP metadata. A Thread interruption will also make this function returning.
DataReadException - If the metadata can not be interpreted correctly.public java.lang.Object[] getRow()
Get the last accepted row.
Note: This function is blocking until a row has been accepted or the end of the stream has been reached. A Thread interruption will also make this function returning.
protected TAPColumn[] extractColMeta(uk.ac.starlink.table.StarTable table) throws DataReadException
TAPColumn objects. Each corresponds to one of the columns listed in the given table,
and so corresponds to the metadata of a column.table - StarTable which contains only the columns' information.TAPColumn objects.DataReadException - If there is a problem while resolving the field datatype (for instance: unknown datatype, a multi-dimensional array is provided, a bad number format for the arraysize).protected java.lang.String getAuxDatumValue(uk.ac.starlink.table.ColumnInfo colInfo,
java.lang.String auxDatumName)
ColumnInfo.colInfo - ColumnInfo from which the auxiliary datum must be extracted.auxDatumName - The name of the datum to extract.