uk.ac.starlink.table.formats
Class PostgresAsciiStarTable
java.lang.Object
uk.ac.starlink.table.AbstractStarTable
uk.ac.starlink.table.formats.StreamStarTable
uk.ac.starlink.table.formats.PostgresAsciiStarTable
- All Implemented Interfaces:
- StarTable
public class PostgresAsciiStarTable
- extends StreamStarTable
StarTable implementation which reads data from a pipe-separated-value
file. This is modelled on the ASCII form of the 2MASS catalogues
as distributed on the 2MASS catalogue DVD set, which claims to be
easy to ingest into PostgreSQL 7.3.2
(see ftp://ftp.ipac.caltech.edu/pub/2mass/allsky/
- Since:
- 12 Sep 2006
Method Summary |
protected RowEvaluator.Metadata |
obtainMetadata()
Obtains metadata for the table by reading the schema provided at
construction time. |
protected java.util.List |
readRow(java.io.PushbackInputStream in)
Reads the next row of data from a given stream. |
protected RowEvaluator.Metadata |
readSchema(java.io.InputStream in)
Given a PostgreSQL/2MASS-type schema file, works out what the
column metadata will look like for each column of the table. |
Methods inherited from class uk.ac.starlink.table.AbstractStarTable |
checkedLongToInt, getCell, getColumnAuxDataInfos, getName, getParameterByName, getParameters, getRow, getURL, isRandom, setName, setParameter, setParameters, setURL |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PostgresAsciiStarTable
public PostgresAsciiStarTable(DataSource datsrc,
java.net.URL schemaUrl)
throws java.io.IOException
- Constructor.
- Parameters:
datsrc
- input data sourceschemaUrl
- URL for 'schema' document which describes data
types (like twomass_psc_schema)
- Throws:
java.io.IOException
readRow
protected java.util.List readRow(java.io.PushbackInputStream in)
throws TableFormatException,
java.io.IOException
- Description copied from class:
StreamStarTable
- Reads the next row of data from a given stream.
Ignorable rows are skipped; comments may be stashed away.
- Specified by:
readRow
in class StreamStarTable
- Parameters:
in
- input stream
- Returns:
- list of Strings one for each cell in the row, or
null for end of stream
- Throws:
TableFormatException
- if the data doesn't represent this
kind of table
java.io.IOException
- if I/O error is encountered
obtainMetadata
protected RowEvaluator.Metadata obtainMetadata()
throws java.io.IOException
- Obtains metadata for the table by reading the schema provided at
construction time.
- Specified by:
obtainMetadata
in class StreamStarTable
- Returns:
- information about the table represented by the character
stream
- Throws:
TableFormatException
- if the data doesn't represent this
kind of table
java.io.IOException
- if I/O error is encountered
readSchema
protected RowEvaluator.Metadata readSchema(java.io.InputStream in)
throws java.io.IOException
- Given a PostgreSQL/2MASS-type schema file, works out what the
column metadata will look like for each column of the table.
- Parameters:
in
- input stream for schema file
- Returns:
- metadata object
- Throws:
java.io.IOException