uk.ac.starlink.fits
Class ColFitsStarTable

java.lang.Object
  extended by uk.ac.starlink.table.AbstractStarTable
      extended by uk.ac.starlink.fits.ColFitsStarTable
All Implemented Interfaces:
Closeable, StarTable

public class ColFitsStarTable
extends AbstractStarTable
implements Closeable

StarTable based on a single-row FITS BINTABLE which contains the data for an entire column in each cell of the table. The BINTABLE must be the first extension of a FITS file.

Some instances of this class hang on to file descriptors. If you are in danger of running out of that resource before insstances are garbage collected, you can call the close() method to release them. Attempting to read data following such a call may result in an exception.

Since:
21 Jun 2006

Constructor Summary
ColFitsStarTable(DataSource datsrc, nom.tam.fits.Header hdr, long dataPos, boolean force, WideFits wide)
          Constructor.
 
Method Summary
 void close()
           
 Object getCell(long irow, int icol)
          The AbstractStarTable implementation of this method throws an UnsupportedOperationException, since unless otherwise provided there is no random access.
 int getColumnCount()
          Returns the number of columns in this table.
 ColumnInfo getColumnInfo(int icol)
          Returns the object describing the data in a given column.
 Object[] getRow(long irow)
          The AbstractStarTable implementation of this method constructs a row by repeated invocation of AbstractStarTable.getCell(long, int).
 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.
 boolean isRandom()
          The AbstractStarTable implementation of this method returns false.
 
Methods inherited from class uk.ac.starlink.table.AbstractStarTable
checkedLongToInt, getColumnAuxDataInfos, getName, getParameterByName, getParameters, getURL, setName, setParameter, setParameters, setURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColFitsStarTable

public ColFitsStarTable(DataSource datsrc,
                        nom.tam.fits.Header hdr,
                        long dataPos,
                        boolean force,
                        WideFits wide)
                 throws IOException
Constructor.

Parameters:
datsrc - data source containing the FITS data
hdr - header of the HDU containing the table
dataPos - offset into file of the start of the data part of the HDU
force - true to make a table if we possibly can, false to reject if it doesn't look very much like one
wide - convention for representing extended columns; use null to avoid use of extended columns
Throws:
IOException
Method Detail

getColumnCount

public int getColumnCount()
Description copied from interface: StarTable
Returns the number of columns in this table.

Specified by:
getColumnCount in interface StarTable
Specified by:
getColumnCount in class AbstractStarTable
Returns:
the number of columns

getRowCount

public long getRowCount()
Description copied from interface: StarTable
Returns the number of rows in this table, if known. If the number of rows cannot be (easily) determined, a value of -1 will be returned.

Specified by:
getRowCount in interface StarTable
Specified by:
getRowCount in class AbstractStarTable
Returns:
the number of rows, or -1

isRandom

public boolean isRandom()
Description copied from class: AbstractStarTable
The AbstractStarTable implementation of this method returns false.

Specified by:
isRandom in interface StarTable
Overrides:
isRandom in class AbstractStarTable
Returns:
true if table random access methods are available

getColumnInfo

public ColumnInfo getColumnInfo(int icol)
Description copied from interface: StarTable
Returns the object describing the data in a given column.

Specified by:
getColumnInfo in interface StarTable
Specified by:
getColumnInfo in class AbstractStarTable
Parameters:
icol - the column for which header information is required
Returns:
a ValueInfo object for column icol

getCell

public Object getCell(long irow,
                      int icol)
               throws IOException
Description copied from class: AbstractStarTable
The AbstractStarTable implementation of this method throws an UnsupportedOperationException, since unless otherwise provided there is no random access.

Specified by:
getCell in interface StarTable
Overrides:
getCell in class AbstractStarTable
Parameters:
irow - the index of the cell's row
icol - the index of the cell's column
Returns:
the contents of this cell
Throws:
IOException - if there is an error reading the data

getRow

public Object[] getRow(long irow)
                throws IOException
Description copied from class: AbstractStarTable
The AbstractStarTable implementation of this method constructs a row by repeated invocation of AbstractStarTable.getCell(long, int).

Specified by:
getRow in interface StarTable
Overrides:
getRow in class AbstractStarTable
Parameters:
irow - the index of the row to retrieve
Returns:
an array of the objects in each cell in row irow
Throws:
IOException - if there is an error reading the data

getRowSequence

public RowSequence getRowSequence()
                           throws IOException
Description copied from interface: StarTable
Returns an object which can iterate over all the rows in the table sequentially.

Specified by:
getRowSequence in interface StarTable
Specified by:
getRowSequence in class AbstractStarTable
Returns:
an object providing sequential access to the table data
Throws:
IOException - if there is an error providing access

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

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