|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eap.fits.FitsFile
Represents an entire fits file. This particular class is mostly useful for
FITS files created in memory.
It allows access to the component HDUs, and
it has a method for writing the file.
Subclasses like
InputStreamFitsFile
and
RandomAccessFitsFile
provide the functionality to read from a FITS
data source. The HDU access methods in this class allow you to read only
part of a FITS file in order to minimize memory usage and I/O, even though
only the subclasses can take advantage of them.
Field Summary | |
static int |
BLOCK_SIZE
The number of bytes in a single FITS block - 2880 according to the FITS standard |
static int |
DATA_NOT_NEEDED
Specifies that the data need not be read, and that the ability to read the data later need not be preserved. |
protected List |
hdus
an ordered list of the HDUs which have been read |
protected Map |
index
a collection of the HDUs indexed by EXTNAME |
protected boolean |
isComplete
a flag indicating whether all the HDUs have been read |
static int |
NEED_DATA_LATER
specifies that the data need not be read before returning the HDU, but that the ability to read the data later should be preserved. |
static int |
NEED_DATA_NOW
Specifies that the data part of an HDU should be read before returning an HDU |
Constructor Summary | |
FitsFile()
Create a new empty FITS file with no HDUs (not even the primary one). |
Method Summary | |
void |
add(FitsHDU hdu)
add an HDU to this file |
static FitsFile |
createEmpty()
factory method to create a new empty FITS file. |
FitsHDU |
getHDU(int number)
returns one of the HDUs in this file. |
FitsHDU |
getHDU(int number,
int when)
return a given HDU structure, specifying a hint about whether to read the HDU data. |
FitsHDU |
getHDU(String name)
return an HDU structure with the corresponding EXTNAME. |
boolean |
isComplete()
returns true if all HDUs in this file have been found. |
void |
write(OutputStream stream)
write the file to an output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BLOCK_SIZE
public static final int NEED_DATA_NOW
public static final int NEED_DATA_LATER
public static final int DATA_NOT_NEEDED
protected List hdus
protected Map index
protected boolean isComplete
Constructor Detail |
public FitsFile()
createEmpty()
to make an empty file with a default
primary HDU.
Method Detail |
public boolean isComplete()
isComplete
.public void add(FitsHDU hdu)
hdu
- the HDU to be added to this file.public FitsHDU getHDU(int number) throws IOException
number
- the index of the HDU. The primary HDU is "0".
IOException
- if there was trouble reading the specified HDU from a
file.public FitsHDU getHDU(String name) throws IOException
name
- the value of the EXTNAME keyword in the desired HDU
IOException
- if there was trouble reading the specified HDU from a
file.public FitsHDU getHDU(int number, int when) throws IOException
FitsHDU
class holds the entire data content of the HDU in
memory. So this method allows you to save memory and the time it takes to
read the HDU contents if all you are interested in is the header keywords.
Note that only certain types of FITS files (in particular
RandomAccessFitsFile
) can take advantage of the hint. The header
keywords are always read.
number
- the index of the HDU with zero being the primary HDU.when
- the code indicating when the data will be needed.
It must have one of the values:
NEED_DATA_NOW
,
NEED_DATA_LATER
, or
DATA_NOT_NEEDED
.
IOException
- if there was trouble reading the specified HDU from a
file.public void write(OutputStream stream) throws IOException
stream
- The output stream where the file will be written.
IOException
- is there was trouble writing the file.public static FitsFile createEmpty() throws FitsException
FitsException
- if there was trouble creating the file, although this
is unlikely to ever happen.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |