|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.ac.starlink.ttools.StreamRowStore
RowStore implementation whose returned table reads from a stream. The iterator got from getStarTable().getRowSequence() will return the rows fed to this object's acceptRow method. Some of the methods block, and the reading and writing have to be done in different threads.
The returned table is unusual in that * (for obvious reasons) it
can only return a RowSequence once. This violates the normal rules
of the StarTable interface. Any calls beyond the first to
getStarTable().getRowSequence() will throw a
StreamRereadException
.
Constructor Summary | |
StreamRowStore()
Constructs a new streaming row store with a default buffer size. |
|
StreamRowStore(int queueSize)
Constructs a new streaming row store with a given buffer size. |
Method Summary | |
void |
acceptMetadata(StarTable meta)
Takes delivery of a row-less StarTable object which defines the metadata of the table to be transmitted. |
void |
acceptRow(Object[] row)
Takes delivery of one row of data. |
void |
close()
Indicates that this sequence will not be required any more. |
void |
endRows()
Signals that there are no more rows to be transmitted. |
Object |
getCell(int icol)
Returns the contents of a cell in the current row. |
Object[] |
getRow()
Returns the contents of the current table row, as an array with the same number of elements as there are columns in this table. |
StarTable |
getStarTable()
Returns a non-random table whose first call to getRowSequence will return a sequence that steps through the same rows which are being written to this sink. |
boolean |
next()
Attempts to advances the current row to the next one. |
void |
setError(IOException error)
Registers an exception which has taken place in supplying the data to this row store. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StreamRowStore()
public StreamRowStore(int queueSize)
queueSize
- the maximum number of rows buffered between
write and read before acceptRow will blockMethod Detail |
public void setError(IOException error)
error
- stored exceptionpublic void acceptMetadata(StarTable meta)
TableSink
StarTable.getRowCount()
); if it is not known, the row count
should be -1. However, this object should not attempt to read
any of meta's cell data.
The data to be transmitted in subsequent calls of acceptRow must match the metadata transmitted in this call in the same way that rows of a StarTable must match its own metadata (number and content clases of columns etc). If this sink cannot dispose of a table corresponding to meta then it may throw a TableFormatException - this may be the case if for instance meta has columns with types that this sink can't deal with.
acceptMetadata
in interface TableSink
meta
- table metadata objectpublic void acceptRow(Object[] row) throws IOException
TableSink
acceptRow
in interface TableSink
row
- table data row
IOException
public void endRows()
TableSink
endRows
in interface TableSink
public StarTable getStarTable()
StreamRereadException
.
getStarTable
in interface RowStore
public boolean next() throws IOException
RowSequence
RowSequence.getCell(int)
or RowSequence.getRow()
methods.
next
in interface RowSequence
IOException
- if there is some errorpublic Object[] getRow()
RowSequence
getRow
in interface RowSequence
public Object getCell(int icol)
RowSequence
getCell
in interface RowSequence
public void close()
RowSequence
close
is undefined.
close
in interface RowSequence
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |