org.jscience.io.fits
Class InputStreamFitsFile

java.lang.Object
  extended by org.jscience.io.fits.FitsFile
      extended by org.jscience.io.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 org.jscience.io.fits.FitsFile
BLOCK_SIZE, DATA_NOT_NEEDED, hdus, index, isComplete, NEED_DATA_LATER, NEED_DATA_NOW
 
Constructor Summary
InputStreamFitsFile(java.io.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(java.lang.String name)
          returns an HDU specified by EXTNAME
 FitsHDU getHDU(java.lang.String name, int when)
          returns an HDU specified by name with a hint for when to read the data.
 
Methods inherited from class org.jscience.io.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(java.io.InputStream file)
                    throws java.io.IOException
Create a new object specifiying the data source

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

getHDU

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

Overrides:
getHDU in class FitsFile
Parameters:
number - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

getHDU

public FitsHDU getHDU(int number,
                      int when)
               throws java.io.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:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!
NoSuchFitsHDUException - DOCUMENT ME!

getHDU

public FitsHDU getHDU(java.lang.String name)
               throws java.io.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:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

getHDU

public FitsHDU getHDU(java.lang.String name,
                      int when)
               throws java.io.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.
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - if there was trouble with the underlying I/O
NoSuchFitsHDUException - if the named HDU is not present in the file.