nom.tam.fits
Class BasicHDU

java.lang.Object
  extended by nom.tam.fits.BasicHDU
All Implemented Interfaces:
FitsElement
Direct Known Subclasses:
ImageHDU, RandomGroupsHDU, TableHDU, UndefinedHDU

public abstract class BasicHDU
extends java.lang.Object
implements FitsElement

This abstract class is the parent of all HDU types. It provides basic functionality for an HDU.


Field Summary
static int BITPIX_BYTE
           
static int BITPIX_DOUBLE
           
static int BITPIX_FLOAT
           
static int BITPIX_INT
           
static int BITPIX_LONG
           
static int BITPIX_SHORT
           
protected  boolean isPrimary
          Is this the first HDU in a FITS file?
protected  Data myData
          The associated data unit.
protected  Header myHeader
          The associated header.
 
Constructor Summary
BasicHDU()
           
 
Method Summary
 void addValue(java.lang.String key, boolean val, java.lang.String comment)
          Add information to the header
 void addValue(java.lang.String key, double val, java.lang.String comment)
           
 void addValue(java.lang.String key, int val, java.lang.String comment)
           
 void addValue(java.lang.String key, java.lang.String val, java.lang.String comment)
           
 java.lang.String getAuthor()
          Return the name of the person who compiled the information in the data associated with this header.
 int[] getAxes()
           
 int getBitPix()
           
 int getBlankValue()
           
 double getBScale()
           
 java.lang.String getBUnit()
           
 double getBZero()
           
 java.util.Date getCreationDate()
          Get the FITS file creation date as a Date object.
 Data getData()
          Get the associated Data object
static BasicHDU getDummyHDU()
           
 double getEpoch()
          Deprecated. Replaced by getEquinox
 double getEquinox()
          Get the equinox in years for the celestial coordinate system in which positions given in either the header or data are expressed.
 long getFileOffset()
          Get the starting offset of the HDU
 int getGroupCount()
           
 Header getHeader()
          Get the associated header
 java.lang.String getInstrument()
          Get the name of the instrument which was used to acquire the data in this FITS file.
 java.lang.Object getKernel()
          Get the non-FITS data object
 double getMaximumValue()
          Return the minimum valid value in the array.
 double getMinimumValue()
          Return the minimum valid value in the array.
 java.lang.String getObject()
          Get the name of the observed object in this FITS file.
 java.util.Date getObservationDate()
          Get the FITS file observation date as a Date object.
 java.lang.String getObserver()
          Get the name of the person who acquired the data in this FITS file.
 java.lang.String getOrigin()
          Get the name of the organization which created this FITS file.
 int getParameterCount()
           
 java.lang.String getReference()
          Return the citation of a reference where the data associated with this header are published.
 long getSize()
          Get the total size in bytes of the HDU.
 java.lang.String getTelescope()
          Get the name of the telescope which was used to acquire the data in this FITS file.
 java.lang.String getTrimmedString(java.lang.String keyword)
          Get the String value associated with keyword.
abstract  void info()
          Print out some information about this HDU.
static boolean isHeader(Header header)
          Check that this is a valid header for the HDU.
 void read(ArrayDataInput stream)
          Read the contents of the element from an input source.
 void readData(ArrayDataInput stream)
          Read in the Data object for this HDU.
 void rewrite()
          Rewrite the HDU
 boolean rewriteable()
          Is the HDU rewriteable
 void skipData(ArrayDataInput stream)
          Skip the Data object for this HDU.
static void skipData(ArrayDataInput stream, Header hdr)
          Skip the Data object immediately after the given Header object on the given stream object.
 void write(ArrayDataOutput stream)
          Write the contents of the element to a data sink.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BITPIX_BYTE

public static final int BITPIX_BYTE
See Also:
Constant Field Values

BITPIX_SHORT

public static final int BITPIX_SHORT
See Also:
Constant Field Values

BITPIX_INT

public static final int BITPIX_INT
See Also:
Constant Field Values

BITPIX_LONG

public static final int BITPIX_LONG
See Also:
Constant Field Values

BITPIX_FLOAT

public static final int BITPIX_FLOAT
See Also:
Constant Field Values

BITPIX_DOUBLE

public static final int BITPIX_DOUBLE
See Also:
Constant Field Values

myHeader

protected Header myHeader
The associated header.


myData

protected Data myData
The associated data unit.


isPrimary

protected boolean isPrimary
Is this the first HDU in a FITS file?

Constructor Detail

BasicHDU

public BasicHDU()
Method Detail

skipData

public static void skipData(ArrayDataInput stream,
                            Header hdr)
                     throws java.io.IOException
Skip the Data object immediately after the given Header object on the given stream object.

Parameters:
stream - the stream which contains the data.
Header - template indicating length of Data section
Throws:
java.io.IOException - if the Data object could not be skipped.

skipData

public void skipData(ArrayDataInput stream)
              throws java.io.IOException
Skip the Data object for this HDU.

Parameters:
stream - the stream which contains the data.
Throws:
java.io.IOException - if the Data object could not be skipped.

readData

public void readData(ArrayDataInput stream)
              throws FitsException
Read in the Data object for this HDU.

Parameters:
stream - the stream from which the data is read.
Throws:
FitsException - if the Data object could not be created from this HDU's Header

getHeader

public Header getHeader()
Get the associated header


getFileOffset

public long getFileOffset()
Get the starting offset of the HDU

Specified by:
getFileOffset in interface FitsElement

getData

public Data getData()
Get the associated Data object


getKernel

public java.lang.Object getKernel()
Get the non-FITS data object


getSize

public long getSize()
Get the total size in bytes of the HDU.

Specified by:
getSize in interface FitsElement
Returns:
The size in bytes.

isHeader

public static boolean isHeader(Header header)
Check that this is a valid header for the HDU.

Parameters:
header - to validate.
Returns:
true if this is a valid header.

info

public abstract void info()
Print out some information about this HDU.


read

public void read(ArrayDataInput stream)
          throws FitsException,
                 java.io.IOException
Description copied from interface: FitsElement
Read the contents of the element from an input source.

Specified by:
read in interface FitsElement
Parameters:
stream - The input source.
Throws:
FitsException
java.io.IOException

write

public void write(ArrayDataOutput stream)
           throws FitsException
Description copied from interface: FitsElement
Write the contents of the element to a data sink.

Specified by:
write in interface FitsElement
Parameters:
stream - The data sink.
Throws:
FitsException

rewriteable

public boolean rewriteable()
Is the HDU rewriteable

Specified by:
rewriteable in interface FitsElement

rewrite

public void rewrite()
             throws FitsException,
                    java.io.IOException
Rewrite the HDU

Specified by:
rewrite in interface FitsElement
Throws:
FitsException
java.io.IOException

getTrimmedString

public java.lang.String getTrimmedString(java.lang.String keyword)
Get the String value associated with keyword.

Parameters:
hdr - the header piece of an HDU
keyword - the FITS keyword
Returns:
either null or a String with leading/trailing blanks stripped.

getBitPix

public int getBitPix()
              throws FitsException
Throws:
FitsException

getAxes

public int[] getAxes()
              throws FitsException
Throws:
FitsException

getParameterCount

public int getParameterCount()

getGroupCount

public int getGroupCount()

getBScale

public double getBScale()

getBZero

public double getBZero()

getBUnit

public java.lang.String getBUnit()

getBlankValue

public int getBlankValue()
                  throws FitsException
Throws:
FitsException

getCreationDate

public java.util.Date getCreationDate()
Get the FITS file creation date as a Date object.

Returns:
either null or a Date object

getObservationDate

public java.util.Date getObservationDate()
Get the FITS file observation date as a Date object.

Returns:
either null or a Date object

getOrigin

public java.lang.String getOrigin()
Get the name of the organization which created this FITS file.

Returns:
either null or a String object

getTelescope

public java.lang.String getTelescope()
Get the name of the telescope which was used to acquire the data in this FITS file.

Returns:
either null or a String object

getInstrument

public java.lang.String getInstrument()
Get the name of the instrument which was used to acquire the data in this FITS file.

Returns:
either null or a String object

getObserver

public java.lang.String getObserver()
Get the name of the person who acquired the data in this FITS file.

Returns:
either null or a String object

getObject

public java.lang.String getObject()
Get the name of the observed object in this FITS file.

Returns:
either null or a String object

getEquinox

public double getEquinox()
Get the equinox in years for the celestial coordinate system in which positions given in either the header or data are expressed.

Returns:
either null or a String object

getEpoch

public double getEpoch()
Deprecated. Replaced by getEquinox

Get the equinox in years for the celestial coordinate system in which positions given in either the header or data are expressed.

Returns:
either null or a String object
See Also:
getEquinox()

getAuthor

public java.lang.String getAuthor()
Return the name of the person who compiled the information in the data associated with this header.

Returns:
either null or a String object

getReference

public java.lang.String getReference()
Return the citation of a reference where the data associated with this header are published.

Returns:
either null or a String object

getMaximumValue

public double getMaximumValue()
Return the minimum valid value in the array.

Returns:
minimum value.

getMinimumValue

public double getMinimumValue()
Return the minimum valid value in the array.

Returns:
minimum value.

addValue

public void addValue(java.lang.String key,
                     boolean val,
                     java.lang.String comment)
              throws HeaderCardException
Add information to the header

Throws:
HeaderCardException

addValue

public void addValue(java.lang.String key,
                     int val,
                     java.lang.String comment)
              throws HeaderCardException
Throws:
HeaderCardException

addValue

public void addValue(java.lang.String key,
                     double val,
                     java.lang.String comment)
              throws HeaderCardException
Throws:
HeaderCardException

addValue

public void addValue(java.lang.String key,
                     java.lang.String val,
                     java.lang.String comment)
              throws HeaderCardException
Throws:
HeaderCardException

getDummyHDU

public static BasicHDU getDummyHDU()