Package nom.tam.fits

Class BinaryTableHDU

All Implemented Interfaces:
FitsElement
Direct Known Subclasses:
CompressedImageHDU, CompressedTableHDU

public class BinaryTableHDU extends TableHDU<BinaryTable>
Binary table header/data unit.
See Also:
  • Constructor Details

    • BinaryTableHDU

      public BinaryTableHDU(Header hdr, BinaryTable datum)
      Deprecated.
      (for internal use) Its visibility should be reduced to package level in the future.
      Creates a new binary table HDU from the specified FITS header and associated table data
      Parameters:
      hdr - the FITS header describing the data and any user-specific keywords
      datum - the corresponding data object
  • Method Details

    • wrap

      public static BinaryTableHDU wrap(BinaryTable tab) throws FitsException
      Wraps the specified table in an HDU, creating a header for it with the essential table description. Users may want to complete the table description with optional FITS keywords such as TTYPEn, TUNITn etc. It is strongly recommended that the table structure (rows or columns) isn't altered after the table is encompassed in an HDU, since there is no guarantee that the header description will be kept in sync.
      Parameters:
      tab - the binary table to wrap into a new HDU
      Returns:
      A new HDU encompassing and describing the supplied table.
      Throws:
      FitsException - if the table structure is invalid, and cannot be described in a header (should never really happen, but we keep the possibility open to it).
      Since:
      1.18
      See Also:
    • encapsulate

      @Deprecated public static BinaryTable encapsulate(Object o) throws FitsException
      Deprecated.
      (for internal use) Use BinaryTable.fromColumnMajor(Object[]) or BinaryTable.fromRowMajor(Object[][]) instead. Will reduce visibility in the future.
      Parameters:
      o - data to encapsulate
      Returns:
      Encapsulate data in a BinaryTable data type
      Throws:
      FitsException - if the type of the data is not usable as data
    • isData

      @Deprecated public static boolean isData(Object o)
      Deprecated.
      (for internal use) Will reduce visibility in the future
      Check if this data object is consistent with a binary table.
      Parameters:
      o - a column table object, an Object[][], or an Object[]. This routine doesn't check that the dimensions of arrays are properly consistent.
      Returns:
      true if the data object can be represented as a FITS binary table, otherwise false.
    • isHeader

      @Deprecated public static boolean isHeader(Header header)
      Deprecated.
      (for internal use) Will reduce visibility in the future
      Check that this is a valid binary table header.
      Parameters:
      header - to validate.
      Returns:
      true if this is a binary table header.
    • manufactureData

      @Deprecated public static BinaryTable manufactureData(Header header) throws FitsException
      Deprecated.
      (for internal use) Will reduce visibility in the future
      Prepares a data object into which the actual data can be read from an input subsequently or at a later time.
      Parameters:
      header - The FITS header that describes the data
      Returns:
      A data object that support reading content from a stream.
      Throws:
      FitsException - if the data could not be prepared to prescriotion.
    • manufactureHeader

      @Deprecated public static Header manufactureHeader(Data data) throws FitsException
      Deprecated.
      (for internal use) Will reduce visibility in the future
      Parameters:
      data - the data used to build the binary table. This is typically some kind of array of objects.
      Returns:
      a newly created binary table HDU from the supplied data.
      Throws:
      FitsException - if there was a problem with the data.
    • addColumn

      public int addColumn(Object data) throws FitsException
      Description copied from class: TableHDU
      Add a column to the table without any associated header information.
      Overrides:
      addColumn in class TableHDU<BinaryTable>
      Parameters:
      data - the new column information. the newCol should be an Object[] where type of all of the constituents is identical. The length of data should match the other columns. Note: It is valid for data to be a 2 or higher dimensionality primitive array. In this case the column index is the first (in Java speak) index of the array. E.g., if called with int[30][20][10], the number of rows in the table should be 30 and this column will have elements which are 2-d integer arrays with TDIM = (10,20).
      Returns:
      the number of columns in the adapted table
      Throws:
      FitsException - if the operation failed
    • info

      public void info(PrintStream stream)
      Description copied from class: BasicHDU
      Print out some information about this HDU.
      Specified by:
      info in class BasicHDU<BinaryTable>
      Parameters:
      stream - the printstream to write the info on
    • isHeader

      @Deprecated public boolean isHeader()
      Deprecated.
      (for internal use) Will reduce visibility in the future
      Check that this HDU has a valid header.
      Returns:
      true if this HDU has a valid header.
    • getColumnDescriptor

      public BinaryTable.ColumnDesc getColumnDescriptor(int col)
      Returns a copy of the column descriptor of a given column in this table
      Parameters:
      col - the zero-based column index
      Returns:
      a copy of the column's descriptor
      Since:
      1.18
      See Also:
    • setColumnName

      public void setColumnName(int index, String name, String comment) throws IndexOutOfBoundsException, HeaderCardException
      Description copied from class: TableHDU
      Sets the name / ID of a specific column in this table. Naming columns is generally a good idea so that people can figure out what sort of data actually appears in specific table columns.
      Overrides:
      setColumnName in class TableHDU<BinaryTable>
      Parameters:
      index - the column index
      name - the name or ID we want to assing to the column
      comment - Any additional comment we would like to store alongside in the FITS header. (The comment may be truncated or even ommitted, depending on space constraints in the FITS header.
      Throws:
      IndexOutOfBoundsException - if the table has no column matching the index
      HeaderCardException - if there was a problem wil adding the associated descriptive FITS header keywords to this table's header.
      See Also:
    • convertToBits

      public final boolean convertToBits(int col) throws FitsException
      Converts a column from FITS logical values to bits. Null values (allowed in logical columns) will map to false. It is legal to call this on a column that is already containing bits.
      Parameters:
      col - The zero-based index of the column to be reset.
      Returns:
      Whether the conversion was possible. *
      Throws:
      FitsException - if the header could not be updated
      Since:
      1.18
    • setComplexColumn

      public boolean setComplexColumn(int index) throws FitsException
      Convert a column in the table to complex. Only tables with appropriate types and dimensionalities can be converted. It is legal to call this on a column that is already complex.
      Parameters:
      index - The zero-based index of the column to be converted.
      Returns:
      Whether the column can be converted
      Throws:
      FitsException - if the header could not be updated
      See Also:
    • write

      public void write(ArrayDataOutput out) throws FitsException
      Description copied from interface: FitsElement
      Writes the contents of the element to a data sink, adding padding as necessary if the element (such as a header or data segment) is expected to complete the FITS block of 2880 bytes.
      Specified by:
      write in interface FitsElement
      Overrides:
      write in class BasicHDU<BinaryTable>
      Parameters:
      out - The data sink.
      Throws:
      FitsException - if the write was unsuccessful.