# Class PostgresAsciiStarTable

java.lang.Object
uk.ac.starlink.table.AbstractStarTable
uk.ac.starlink.table.formats.StreamStarTable
uk.ac.starlink.ttools.example.PostgresAsciiStarTable

All Implemented Interfaces:
  `Closeable, AutoCloseable, uk.ac.starlink.table.StarTable`

public class PostgresAsciiStarTable extends uk.ac.starlink.table.formats.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
Author:
  Mark Taylor

## Field Summary

### Fields inherited from class uk.ac.starlink.table.formats.StreamStarTable

`END`

## Constructor Summary

Constructors
Constructor
Description
`PostgresAsciiStarTable(uk.ac.starlink.util.DataSource datsrc, URL schemaUrl)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected uk.ac.starlink.table.formats.RowEvaluator.Metadata`
`obtainMetadata()`
Obtains metadata for the table by reading the schema provided at construction time.
`protected List<String>`
`readRow(PushbackInputStream in)`
`protected uk.ac.starlink.table.formats.RowEvaluator.Metadata`
`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, close, getCell, getColumnAuxDataInfos, getName, getParameters, getRow, getRowAccess, getRowSplittable, getURL, isRandom, setName, setParameters, setURL`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface uk.ac.starlink.table.StarTable

`getParameterByName, setParameter`

## Constructor Details

### PostgresAsciiStarTable

public PostgresAsciiStarTable(uk.ac.starlink.util.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)
Throws:
  `IOException`

## Method Details

### readRow

protected List<String> readRow(PushbackInputStream in) throws uk.ac.starlink.table.TableFormatException, IOException

Specified by:
  `readRow` in class `uk.ac.starlink.table.formats.StreamStarTable`
Throws:
  `uk.ac.starlink.table.TableFormatException`
  `IOException`

### obtainMetadata

protected uk.ac.starlink.table.formats.RowEvaluator.Metadata obtainMetadata() throws IOException
Obtains metadata for the table by reading the schema provided at construction time.

Specified by:
  `obtainMetadata` in class `uk.ac.starlink.table.formats.StreamStarTable`
Throws:
  `IOException`

### readSchema

protected uk.ac.starlink.table.formats.RowEvaluator.Metadata 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:
  metadata object
Throws:
  `IOException`