public class Fits extends Object
Description of the Package
This FITS package attempts to make using FITS files easy, but does not do exhaustive error checking. Users should not assume that just because a FITS file can be read and written that it is necessarily legal FITS.
Constructor and Description |
---|
Fits()
Create an empty Fits object which is not
associated with an input stream.
|
Fits(File myFile)
Associate FITS object with an uncompressed File
|
Fits(File myFile,
boolean compressed)
Associate the Fits object with a File
|
Fits(InputStream str)
Create a Fits object associated with
the given uncompressed data stream.
|
Fits(InputStream str,
boolean compressed)
Create a Fits object associated with a possibly
compressed data stream.
|
Fits(String filename)
Associate the FITS object with a file or URL.
|
Fits(URL myURL)
Associate the FITS object with a given uncompressed URL
|
Fits(URL myURL,
boolean compressed)
Associate the FITS object with a given URL
|
Modifier and Type | Method and Description |
---|---|
void |
addHDU(BasicHDU myHDU)
Add an HDU to the Fits object.
|
int |
currentSize()
Deprecated.
See getNumberOfHDUs()
|
void |
deleteHDU(int n)
Delete an HDU from the HDU list.
|
protected void |
fileInit(File myFile,
boolean compressed)
Get a stream from the file and then use the stream initialization.
|
BasicHDU |
getHDU(int n)
Return the n'th HDU.
|
int |
getNumberOfHDUs()
Get the current number of HDUs in the Fits object.
|
ArrayDataInput |
getStream()
Get the data stream used for the Fits Data.
|
void |
insertHDU(BasicHDU myHDU,
int n)
Insert a FITS object into the list of HDUs.
|
static BasicHDU |
makeHDU(Data datum)
Create an HDU from the given Data.
|
static BasicHDU |
makeHDU(Header h)
Create an HDU from the given header.
|
static BasicHDU |
makeHDU(Object o)
Create an HDU from the given data kernel.
|
protected void |
randomInit(String filename)
Initialize using buffered random access
|
BasicHDU[] |
read()
Return all HDUs for the Fits object.
|
void |
read(InputStream is)
Read a FITS file from an InputStream object.
|
BasicHDU |
readHDU()
Read the next HDU on the default input stream.
|
void |
setStream(ArrayDataInput stream)
Set the data stream to be used for future input.
|
int |
size()
Deprecated.
The meaning of size of ambiguous. Use
|
void |
skipHDU()
Skip the next HDU on the default input stream.
|
void |
skipHDU(int n)
Skip HDUs on the associate input stream.
|
protected void |
streamInit(InputStream str,
boolean compressed,
boolean seekable)
Do the stream initialization.
|
static String |
version()
Indicate the version of these classes
|
void |
write(DataOutput os)
Write a Fits Object to an external Stream.
|
public Fits()
public Fits(InputStream str) throws FitsException
str
- The data stream.FitsException
public Fits(InputStream str, boolean compressed) throws FitsException
str
- The data stream.compressed
- Is the stream compressed?FitsException
public Fits(File myFile) throws FitsException
myFile
- The File object.FitsException
public Fits(File myFile, boolean compressed) throws FitsException
myFile
- The File object.compressed
- Is the data compressed?FitsException
public Fits(String filename) throws FitsException
filename
- The name of the file or URL to be processed.FitsException
- Thrown if unable to find or open
a file or URL from the string given.public Fits(URL myURL) throws FitsException
myURL
- The URL to be associated with the FITS file.FitsException
- Thrown if unable to use the specified URL.public Fits(URL myURL, boolean compressed) throws FitsException
myURL
- The URL to be associated with the FITS file.compressed
- Is the data compressed?FitsException
- Thrown if unable to find or open
a file or URL from the string given.public static String version()
protected void streamInit(InputStream str, boolean compressed, boolean seekable) throws FitsException
str
- The input stream.compressed
- Is this data compressed? If so,
then the GZIPInputStream class will be
used to inflate it.FitsException
protected void randomInit(String filename) throws FitsException
FitsException
protected void fileInit(File myFile, boolean compressed) throws FitsException
myFile
- The File to be associated.compressed
- Is the data compressed?FitsException
public BasicHDU[] read() throws FitsException
FitsException
public BasicHDU readHDU() throws FitsException, IOException
FitsException
IOException
public void skipHDU(int n) throws FitsException, IOException
n
- The number of HDUs to be skipped.FitsException
IOException
public void skipHDU() throws FitsException, IOException
FitsException
IOException
public BasicHDU getHDU(int n) throws FitsException, IOException
n
- The index of the HDU to be read. The primary HDU is index 0.FitsException
IOException
public int size() throws FitsException
FitsException
public void addHDU(BasicHDU myHDU) throws FitsException
myHDU
- The HDU to be added to the end of the FITS object.FitsException
public void insertHDU(BasicHDU myHDU, int n) throws FitsException
myHDU
- The HDU to be inserted into the list of HDUs.n
- The location at which the HDU is to be inserted.FitsException
public void deleteHDU(int n) throws FitsException
n
- The index of the HDU to be deleted.
If n is 0 and there is more than one HDU present, then
the next HDU will be converted from an image to
primary HDU if possible. If not a dummy header HDU
will then be inserted.FitsException
public void write(DataOutput os) throws FitsException
dos
- A DataOutput stream.FitsException
public void read(InputStream is) throws FitsException, IOException
is
- The InputStream stream whence the FITS information
is found.FitsException
IOException
public int currentSize()
public int getNumberOfHDUs()
public ArrayDataInput getStream()
public void setStream(ArrayDataInput stream)
stream
- The data stream to be used.public static BasicHDU makeHDU(Header h) throws FitsException
h
- The header which describes the FITS extensionFitsException
public static BasicHDU makeHDU(Object o) throws FitsException
o
- The data to be described in this HDU.FitsException
public static BasicHDU makeHDU(Data datum) throws FitsException
datum
- The data to be described in this HDU.FitsException
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.