nom.tam.fits
Class BinaryTableHeaderParser

java.lang.Object
  extended by nom.tam.fits.BinaryTableHeaderParser

public class BinaryTableHeaderParser
extends java.lang.Object

This class defines the methods for accessing FITS binary table header information.


Constructor Summary
BinaryTableHeaderParser(Header myHeader)
          Parse an existing header.
 
Method Summary
static void addColumn(int column, java.lang.Object[] col, Header myHeader)
          Add a column to the header information.
protected  void checkLT0(int i, java.lang.String errmsg)
          Check if a value is less than 0 and throw an error if so.
protected  java.lang.Object getColumnDef(int col)
          Get the format for a given column
 java.lang.Object[] getModelRow()
          Create a model row for a binary table given a describing header.
static int[] getTDims(java.lang.String tdims, int arrsiz)
          Parse the TDIMS value.
static Header pointToTable(BinaryTable table)
          Make the header describe the a table where we give only.
static Header pointToTable(BinaryTable table, Header myHeader)
          Make the header describe a specified table and included existing header information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryTableHeaderParser

public BinaryTableHeaderParser(Header myHeader)
                        throws FitsException
Parse an existing header.

Parameters:
The - existing header -- likely read from a file.
Throws:
FitsException
Method Detail

getModelRow

public java.lang.Object[] getModelRow()
                               throws FitsException
Create a model row for a binary table given a describing header.

Returns:
A model row for the table.
Throws:
FitsException

checkLT0

protected void checkLT0(int i,
                        java.lang.String errmsg)
                 throws FitsException
Check if a value is less than 0 and throw an error if so.

Parameters:
i - The value to be checked.
errmst - The message to be associated with the FitsException thrown.
Throws:
FitsException

getColumnDef

protected java.lang.Object getColumnDef(int col)
                                 throws FitsException
Get the format for a given column

Parameters:
col - the column being examined.
Returns:
an object of the type described in the column header info. Note that only the TFORM and TDIM keywords are examined.
Throws:
FitsException

getTDims

public static int[] getTDims(java.lang.String tdims,
                             int arrsiz)
Parse the TDIMS value. If the TDIMS value cannot be deciphered a one-d array with the size given in arrsiz is returned.

Parameters:
tdims - The value of the TDIMSn card.
arrsiz - The size field found on the TFORMn card.
Returns:
An int array of the desired dimensions. Note that the order of the tdims is the inverser of the order in the TDIMS key.

pointToTable

public static Header pointToTable(BinaryTable table)
                           throws FitsException
Make the header describe the a table where we give only. a single row of the table and the number of rows.

Throws:
FitsException - if the table was not valid.

pointToTable

public static Header pointToTable(BinaryTable table,
                                  Header myHeader)
                           throws FitsException
Make the header describe a specified table and included existing header information.

Parameters:
table - The binary table data.
myHeader - An existing header for this data. It will be modified as needed, but excess keywords will not be pruned.
Throws:
FitsException

addColumn

public static void addColumn(int column,
                             java.lang.Object[] col,
                             Header myHeader)
                      throws FitsException
Add a column to the header information.

Parameters:
column - The column index for the new column.
col - The column data.
myHeader - The existing header for the table.
Throws:
FitsException