Package nom.tam.fits

Class Data

  • All Implemented Interfaces:
    FitsElement
    Direct Known Subclasses:
    AbstractTableData, ImageData, RandomGroupsData, UndefinedData

    public abstract class Data
    extends java.lang.Object
    implements FitsElement
    This class provides methods to access the data segment of an HDU.

    This is the object which contains the actual data for the HDU.

    • For images and primary data this is a simple (but possibly multi-dimensional) primitive array. When group data is supported it will be a possibly multidimensional array of group objects.
    • For ASCII data it is a two dimensional Object array where each of the constituent objects is a primitive array of length 1.
    • For Binary data it is a two dimensional Object array where each of the constituent objects is a primitive array of arbitrary (more or less) dimensionality.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long dataSize
      The size of the data when last read
      protected long fileOffset
      The starting location of the data when last read
      protected RandomAccess input
      The input stream used.
    • Constructor Summary

      Constructors 
      Constructor Description
      Data()  
    • Field Detail

      • fileOffset

        protected long fileOffset
        The starting location of the data when last read
      • dataSize

        protected long dataSize
        The size of the data when last read
      • input

        protected RandomAccess input
        The input stream used.
    • Constructor Detail

      • Data

        public Data()
    • Method Detail

      • getData

        public abstract java.lang.Object getData()
                                          throws FitsException
        Returns:
        the data array object.
        Throws:
        FitsException - if the data could not be gathered .
      • getFileOffset

        public long getFileOffset()
        Specified by:
        getFileOffset in interface FitsElement
        Returns:
        the file offset
      • getKernel

        public java.lang.Object getKernel()
                                   throws FitsException
        Returns:
        the non-FITS data object.
        Throws:
        FitsException - if the data could not be gathered .
      • getSize

        public long getSize()
        Specified by:
        getSize in interface FitsElement
        Returns:
        the size of the data element in bytes.
      • read

        public abstract void read​(ArrayDataInput in)
                           throws FitsException
        Description copied from interface: FitsElement
        Read a data array into the current object and if needed position to the beginning of the next FITS block.
        Specified by:
        read in interface FitsElement
        Parameters:
        in - The input data stream
        Throws:
        FitsException - if the read was unsuccessful.
      • reset

        public boolean reset()
        Description copied from interface: FitsElement
        Reset the input stream to point to the beginning of this element
        Specified by:
        reset in interface FitsElement
        Returns:
        True if the reset succeeded.
      • rewrite

        public void rewrite()
                     throws FitsException
        Description copied from interface: FitsElement
        Rewrite the contents of the element in place. The data must have been originally read from a random access device, and the size of the element may not have changed.
        Specified by:
        rewrite in interface FitsElement
        Throws:
        FitsException - if the rewrite was unsuccessful.
      • rewriteable

        public boolean rewriteable()
        Specified by:
        rewriteable in interface FitsElement
        Returns:
        true if this element can be rewritten?
      • setFileOffset

        protected void setFileOffset​(ArrayDataInput o)
        Set the fields needed for a re-read.
        Parameters:
        o - reread information.
      • write

        public abstract void write​(ArrayDataOutput o)
                            throws FitsException
        Write the data -- including any buffering needed
        Specified by:
        write in interface FitsElement
        Parameters:
        o - The output stream on which to write the data.
        Throws:
        FitsException - if the write was unsuccessful.