eap.fits
Class InputStreamFitsFile

java.lang.Object
  extended byeap.fits.FitsFile
      extended byeap.fits.InputStreamFitsFile

public class InputStreamFitsFile
extends FitsFile

Represents a FITS file to be read from a serial data source. This class assumes no buffering in the underlying stream, so there is no way to skip an HDU and then go back to read it later.


Field Summary
 
Fields inherited from class eap.fits.FitsFile
BLOCK_SIZE, DATA_NOT_NEEDED, hdus, index, isComplete, NEED_DATA_LATER, NEED_DATA_NOW
 
Constructor Summary
InputStreamFitsFile(InputStream file)
          Create a new object specifiying the data source
 
Method Summary
 FitsHDU getHDU(int number)
          returns an HDU specified by number.
 FitsHDU getHDU(int number, int when)
          returns an HDU specified by number.
 FitsHDU getHDU(String name)
          returns an HDU specified by EXTNAME
 FitsHDU getHDU(String name, int when)
          returns an HDU specified by name with a hint for when to read the data.
 
Methods inherited from class eap.fits.FitsFile
add, createEmpty, isComplete, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputStreamFitsFile

public InputStreamFitsFile(InputStream file)
                    throws IOException
Create a new object specifiying the data source

Parameters:
file - the data source
Throws:
IOException - if there was a problem creating the file.
Method Detail

getHDU

public FitsHDU getHDU(int number)
               throws IOException
returns an HDU specified by number.

Overrides:
getHDU in class FitsFile
Parameters:
number - the index of the HDU. The primary HDU is "0".
Returns:
The object representing the specified HDU.
Throws:
IOException - if there was trouble reading the specified HDU from a file.

getHDU

public FitsHDU getHDU(int number,
                      int when)
               throws IOException
returns an HDU specified by number. The "when" hint is ignored and all data are read before returning. This could probably be changed to accomodate DATA_NOT_NEEDED.

Overrides:
getHDU in class FitsFile
Parameters:
number - the index of the HDU to read. The primary HDU is numbered "0".
when - This parameter is ignored. The data part of the HDU is always read.
Returns:
The named HDU.
Throws:
IOException - if there was trouble reading the specified HDU from a file.

getHDU

public FitsHDU getHDU(String name)
               throws IOException
returns an HDU specified by EXTNAME

Overrides:
getHDU in class FitsFile
Parameters:
name - the EXTNAME of the HDU or "PRIMARY" for the primary HDU.
Returns:
The named HDU.
Throws:
IOException - if there was trouble reading the specified HDU from a file.

getHDU

public FitsHDU getHDU(String name,
                      int when)
               throws IOException
returns an HDU specified by name with a hint for when to read the data.

Parameters:
name - the EXTNAME of the HDU or "PRIMARY" for the primary HDU.
when - this argument is ignored and the data part of the HDU is always read.
Throws:
IOException - if there was trouble with the underlying I/O
NoSuchFitsHDUException - if the named HDU is not present in the file.