uk.ac.starlink.table.formats
Class PostgresAsciiStarTable

java.lang.Object
  extended byuk.ac.starlink.table.AbstractStarTable
      extended byuk.ac.starlink.table.formats.StreamStarTable
          extended byuk.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

Field Summary
 
Fields inherited from class uk.ac.starlink.table.formats.StreamStarTable
END
 
Constructor Summary
PostgresAsciiStarTable(DataSource datsrc, URL schemaUrl)
          Constructor.
 
Method Summary
protected  RowEvaluator.Metadata obtainMetadata()
          Obtains metadata for the table by reading the schema provided at construction time.
protected  List readRow(PushbackInputStream in)
          Reads the next row of data from a given stream.
protected  ColumnInfo[] readSchema(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.formats.StreamStarTable
getColumnCount, getColumnInfo, getInputStream, getRowCount, getRowSequence, init
 
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
 

Constructor Detail

PostgresAsciiStarTable

public PostgresAsciiStarTable(DataSource datsrc,
                              URL schemaUrl)
                       throws IOException
Constructor.

Parameters:
datsrc - input data source
schemaUrl - URL for 'schema' document which describes data types (like twomass_psc_schema)
Method Detail

readRow

protected List readRow(PushbackInputStream in)
                throws TableFormatException,
                       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
IOException - if I/O error is encountered

obtainMetadata

protected RowEvaluator.Metadata obtainMetadata()
                                        throws 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:
IOException - if I/O error is encountered

readSchema

protected ColumnInfo[] readSchema(InputStream in)
                           throws 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:
column metadata array
Throws:
IOException

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.