|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.ac.starlink.table.AbstractStarTable | +--uk.ac.starlink.table.formats.StreamStarTable
Abstract superclass for tables which reads a stream of characters to obtain the row data and metadata. Since metadata is typically scarce in such tables, the strategy is to make one pass through the data attempting to work out column types etc at table initialisation time, and to make a further pass through for each required RowSequence, using the metadata obtained earlier. This superclass contains a rough framework for such behaviour and a number of useful protected classes and methods which may be used to achieve it.
Nested Class Summary | |
protected static class |
StreamStarTable.Decoder
Interface for an object that can turn a string into a cell content object. |
protected static class |
StreamStarTable.Metadata
Helper class used to group quantities which describe what the data types found in the columns of a table are. |
protected static class |
StreamStarTable.RowEvaluator
Helper class to examine unknown rows (arrays of strings) and work out what they contain. |
Field Summary | |
protected static char |
END
Char representation of -1 (as returned end-of-stream read) |
Constructor Summary | |
protected |
StreamStarTable(DataSource datsrc)
Constructor. |
Method Summary | |
int |
getColumnCount()
Returns the number of columns in this table. |
ColumnInfo |
getColumnInfo(int icol)
Returns the object describing the data in a given column. |
protected PushbackInputStream |
getInputStream()
Convenience method which returns a buffered pushback stream based on this table's data source. |
long |
getRowCount()
Returns the number of rows in this table, if known. |
RowSequence |
getRowSequence()
Returns an object which can iterate over all the rows in the table sequentially. |
protected abstract StreamStarTable.Metadata |
obtainMetadata()
Obtains column metadata for this table, probably by reading through the rows once and using a RowEvaluator. |
protected abstract List |
readRow(PushbackInputStream in)
Reads the next row of data from a given stream. |
Methods inherited from class uk.ac.starlink.table.AbstractStarTable |
checkedLongToInt, getCell, getColumnAuxDataInfos, getName, getParameterByName, getParameters, getRow, getURL, isRandom, setName, setParameters, setURL |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final char END
Constructor Detail |
protected StreamStarTable(DataSource datsrc) throws TableFormatException, IOException
datsrc
- data source from which the stream can be obtainedMethod Detail |
public int getColumnCount()
StarTable
getColumnCount
in interface StarTable
getColumnCount
in class AbstractStarTable
public long getRowCount()
StarTable
getRowCount
in interface StarTable
getRowCount
in class AbstractStarTable
public ColumnInfo getColumnInfo(int icol)
StarTable
getColumnInfo
in interface StarTable
getColumnInfo
in class AbstractStarTable
icol
- the column for which header information is required
public RowSequence getRowSequence() throws IOException
StarTable
getRowSequence
in interface StarTable
getRowSequence
in class AbstractStarTable
IOException
- if there is an error providing accessprotected PushbackInputStream getInputStream() throws IOException
IOException
protected abstract StreamStarTable.Metadata obtainMetadata() throws TableFormatException, IOException
TableFormatException
- if the data doesn't represent this
kind of table
IOException
- if I/O error is encounteredprotected abstract List readRow(PushbackInputStream in) throws TableFormatException, IOException
in
- input stream
TableFormatException
- if the data doesn't represent this
kind of table
IOException
- if I/O error is encountered
|
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 |