org.eso.fits
Class FitsHeader

java.lang.Object
  extended by org.eso.fits.FitsHeader

public class FitsHeader
extends java.lang.Object

FITS Header class which is an ordered set of FitsKeywords.


Constructor Summary
FitsHeader()
          Default constructor for empty FitsHeader class
FitsHeader(java.io.DataInput file)
          Constructor for FitsHeader class given a DataInput file positioned at the FITS header.
 
Method Summary
 void addKeyword(FitsKeyword kw)
          Append FITS keyword to the end of the header.
 long getDataSize()
          Compute size of FITS data matrix in bytes
 int getHeaderSpace()
          Get space in FITS header read from file in terms of number of keyword cards to can contain.
 FitsKeyword getKeyword(int no)
          Return a keyword giving its relative position.
 FitsKeyword getKeyword(java.lang.String name)
          Return a keyword giving its name.
 java.util.ListIterator getKeywords()
          Obtain a ListIterator for keywords in the header.
 FitsKeyword[] getKeywords(java.lang.String name)
          Return an array of keywords giving a name.
 java.lang.String getName()
          Get name of FITS HUunit as given by the EXTNAME keyword.
 int getNoKeywords()
          Obtain the total number of keywords in the header.
 int getType()
          Return the type of the FITS header e.g.
 int getVersion()
          Get version of FITS HUunit as given by the EXTVER keyword.
 void insertKeywordAt(FitsKeyword kw, int index)
          Insert FITS keyword at a given position in the header.
 void removeKeywordAt(int index)
          Remove FITS keyword at a given position in the header.
 void setExtension(int type)
          Sets the first keyword in the header to XTENSION with the type indicated.
 java.lang.String toString()
          Generate a string with the FITS header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FitsHeader

public FitsHeader()
Default constructor for empty FitsHeader class


FitsHeader

public FitsHeader(java.io.DataInput file)
           throws FitsException
Constructor for FitsHeader class given a DataInput file positioned at the FITS header.

Parameters:
file - RandomAccess file positioned at the start of a FITS header
Throws:
FitsException
Method Detail

addKeyword

public void addKeyword(FitsKeyword kw)
Append FITS keyword to the end of the header.

Parameters:
kw - FitsKeyword to be appended

insertKeywordAt

public void insertKeywordAt(FitsKeyword kw,
                            int index)
Insert FITS keyword at a given position in the header.

Parameters:
kw - FitsKeyword to be appended
index - place where the keyword should be inserted

removeKeywordAt

public void removeKeywordAt(int index)
Remove FITS keyword at a given position in the header.

Parameters:
index - location of keyword which should be removed

getType

public final int getType()
Return the type of the FITS header e.g. Fits.IMAGE or Fits.BTABLE.


getDataSize

public final long getDataSize()
Compute size of FITS data matrix in bytes


getName

public final java.lang.String getName()
Get name of FITS HUunit as given by the EXTNAME keyword. If this keyword is not present in the header, 'NONE' is returned.


getVersion

public final int getVersion()
Get version of FITS HUunit as given by the EXTVER keyword. If this keyword is not present in the header 1 is returned.


getNoKeywords

public final int getNoKeywords()
Obtain the total number of keywords in the header.


getKeyword

public final FitsKeyword getKeyword(int no)
Return a keyword giving its relative position. If the position is not in the valid range a NULL is returned.

Parameters:
no - position of keyword in header (starting with 0)

getKeyword

public final FitsKeyword getKeyword(java.lang.String name)
Return a keyword giving its name. If there a multiple keywords, the last is returned. In cases where multiple keywords makes sense (e.g. comments), the first of this set is given. If none is found, a NULL is returned.

Parameters:
name - string with name of keyword

getKeywords

public final FitsKeyword[] getKeywords(java.lang.String name)
Return an array of keywords giving a name. If none is found, a NULL is returned.

Parameters:
name - string with name of keyword

getKeywords

public final java.util.ListIterator getKeywords()
Obtain a ListIterator for keywords in the header.


toString

public java.lang.String toString()
Generate a string with the FITS header. The header string will include the END-card and NOT be space filled with empty cards to a full FITS 2880 char record.

Overrides:
toString in class java.lang.Object

getHeaderSpace

public int getHeaderSpace()
Get space in FITS header read from file in terms of number of keyword cards to can contain.


setExtension

public void setExtension(int type)
Sets the first keyword in the header to XTENSION with the type indicated. Nothing will be done if a non-standard extension is specified.

Parameters:
type - Type of FITS extension