Package nom.tam.fits

Class AsciiTableHDU

All Implemented Interfaces:
FitsElement

public class AsciiTableHDU extends TableHDU<AsciiTable>
ASCII table header/data unit. ASCII table HDUs were desgined for human readability, e.g. on a console, without any special tools. However, they are far less flexible or compact than BinaryTableHDU. As such, users are generally discouraged from using this type of HDU to encapsulate FITS table data. FitsFactory.setUseAsciiTables(boolean) can be toggled to adjust whether Fits.makeHDU(Object) or similar methods should construct ASCII tables when possible. (The default setting is to produce binary tables always.)
See Also:
  • Constructor Details

    • AsciiTableHDU

      public AsciiTableHDU(Header h, AsciiTable d)
      Deprecated.
      (for internal use) Its visibility should be reduced to package level in the future.
      Create an ASCII table header/data unit.
      Parameters:
      h - the template specifying the ASCII table.
      d - the FITS data structure containing the table data.
  • Method Details

    • encapsulate

      @Deprecated public static AsciiTable encapsulate(Object o) throws FitsException
      Deprecated.
      (for internal use) Use AsciiTable.fromColumnMajor(Object[]) instead. Will reduce visibility in the future
      Parameters:
      o - the array of object to create the ASCII table
      Returns:
      a ASCII table data structure from an array of objects representing the columns.
      Throws:
      FitsException - if the table could not be created.
    • isData

      @Deprecated public static boolean isData(Object o)
      Deprecated.
      (for internal use) Will reduce visibility in the future
      Parameters:
      o - object representing the data
      Returns:
      true if this data is usable as an ASCII table.
    • isHeader

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

      @Deprecated public static AsciiTable manufactureData(Header hdr) 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:
      hdr - 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 d) throws FitsException
      Deprecated.
      (for internal use) Will reduce visibility in the future
      Parameters:
      d - data to create a header for
      Returns:
      a created header to match the input data.
      Throws:
      FitsException - if the header could not b e created
    • 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<AsciiTable>
      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:
    • addColumn

      public int addColumn(Object newCol) throws FitsException
      Description copied from class: TableHDU
      Add a column to the table without any associated header information.
      Overrides:
      addColumn in class TableHDU<AsciiTable>
      Parameters:
      newCol - 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<AsciiTable>
      Parameters:
      stream - the printstream to write the info on
    • isNull

      public boolean isNull(int row, int col)
      Checks if a table entry is null
      Parameters:
      row - row index of the element
      col - column index of the element
      Returns:
      true if the specified element is null
      See Also:
    • setNull

      public void setNull(int row, int col, boolean flag)
      Mark an entry as null.
      Parameters:
      row - row index of the element
      col - column index of the element
      flag - set to null or not
      See Also:
    • setNullString

      public void setNullString(int col, String newNull) throws IllegalArgumentException
      Set the null string for a column.
      Parameters:
      col - the column index
      newNull - the String representing null
      Throws:
      IllegalArgumentException - if the string argument contains characters that are not allowed in FITS headers. That is if it contains characters outside the range of 0x20 thru 0x7E.