|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.fits.FitsConstants
public class FitsConstants
Utility class providing some constants and static methods related to FITS file format and starlink classes.
Field Summary | |
---|---|
static nom.tam.fits.HeaderCard |
END_CARD
Image of end-of-header card. |
static int |
FITS_BLOCK
Standard size of a FITS block in bytes. |
static java.lang.String |
NDARRAY_ORIGIN
FITS header card for indicating NDArray origin values. |
static java.lang.String |
NDARRAY_PREFIX
Prefix for NDArray-related FITS header cards. |
static java.lang.String |
NDX_PREFIX
Prefix for NDX-related FITS header cards. |
static java.lang.String |
NDX_XML
FITS header card for location (relative URL) of XML representation. |
static java.lang.String |
WCS_ENCODING
Default encoding used for writing WCS into FITS headers. |
Constructor Summary | |
---|---|
FitsConstants()
|
Method Summary | |
---|---|
static void |
addTrimmedValue(nom.tam.fits.Header hdr,
java.lang.String key,
java.lang.String value,
java.lang.String comment)
Adds a string-valued card to the header. |
static java.util.List |
defaultFitsExtensions()
Gets the default permitted list of extensions which identify a FITS resource in the path part of a URL. |
static long |
getDataSize(nom.tam.fits.Header hdr)
Utility function to find the number of bytes in the data segment of an HDU. |
static nom.tam.util.ArrayDataInput |
getInputStream(DataSource datsrc)
Returns an input stream which can be used with the various FITS classes based on a given DataSource object. |
static nom.tam.util.ArrayDataInput |
getInputStreamStart(DataSource datsrc)
Returns an input stream which can be used with the various FITS classes based on a given DataSource object, positioned at the start of the stream. |
static boolean |
isMagic(byte[] buffer)
Indicates whether the supplied buffer is the start of a FITS file. |
static void |
mappableWarning(DataSource datsrc)
Writes suitable messages through the logging system about a DataSource that contains FITS, concerning whether it is mappable (hence efficient to read). |
static long |
positionStream(nom.tam.util.ArrayDataInput strm,
java.lang.String pos)
Advances the position of an input stream according to a position string. |
static int |
readHeader(nom.tam.fits.Header hdr,
nom.tam.util.ArrayDataInput strm)
Populates a header from an input stream, reporting its length in bytes. |
static long |
skipHDUs(nom.tam.util.ArrayDataInput stream,
int nskip)
Skips forward over a given number of HDUs in the supplied stream. |
static void |
writeEmptyPrimary(java.io.DataOutput strm)
Writes a null header representing an empty primary HDU to a stream. |
static void |
writeHeader(java.io.DataOutput strm,
nom.tam.fits.Header hdr)
Writes a header object to a DataOutput. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NDARRAY_PREFIX
public static final nom.tam.fits.HeaderCard END_CARD
public static final java.lang.String NDARRAY_ORIGIN
public static final java.lang.String NDX_PREFIX
public static final java.lang.String NDX_XML
public static final java.lang.String WCS_ENCODING
public static final int FITS_BLOCK
Constructor Detail |
---|
public FitsConstants()
Method Detail |
---|
public static java.util.List defaultFitsExtensions()
public static long skipHDUs(nom.tam.util.ArrayDataInput stream, int nskip) throws java.io.IOException
stream
- the stream to skip throughnskip
- the number of HDUs to skip
java.io.IOException
public static boolean isMagic(byte[] buffer)
buffer
- a byte buffer containing
the start of a file to test
public static nom.tam.util.ArrayDataInput getInputStreamStart(DataSource datsrc) throws java.io.IOException
datsrc
- the DataSource pointing to the file/HDU required
java.io.IOException
public static long positionStream(nom.tam.util.ArrayDataInput strm, java.lang.String pos) throws java.io.IOException
DataSource
.
strm
- the stream to advancepos
- number of HDUs to advance by (as a string)
java.io.IOException
public static nom.tam.util.ArrayDataInput getInputStream(DataSource datsrc) throws java.io.IOException
datsrc
- the DataSource pointing to the file/HDU required
java.io.IOException
public static int readHeader(nom.tam.fits.Header hdr, nom.tam.util.ArrayDataInput strm) throws nom.tam.fits.TruncatedFileException, java.io.IOException
Header.read(nom.tam.util.ArrayDataInput)
, but
it returns the number of bytes read from the input stream in order
to populate the header (including any padding bytes). There is
no way to retrieve this information from the Header class
in general; though Header.getSize()
will sometimes give you the right answer, in the case of
duplicated header keywords it can give an underestimate.
This could be seen as a bug in nom.tam.fits classes,
but there may be code somewhere which relies on that behaviour.
You can make a Header from scratch by doing
Header hdr = new Header(); int headsize = read( hdr, strm );This method also differs from the Header implementation in that it does not print warnings to standard output about duplicate keywords.
hdr
- the header to populatestrm
- the input stream supplying the data
nom.tam.fits.TruncatedFileException
java.io.IOException
Header.read(nom.tam.util.ArrayDataInput)
public static void writeHeader(java.io.DataOutput strm, nom.tam.fits.Header hdr) throws java.io.IOException
strm
- destination streamhdr
- the header to write
java.io.IOException
public static void writeEmptyPrimary(java.io.DataOutput strm) throws java.io.IOException
strm
- stream to write to
java.io.IOException
public static long getDataSize(nom.tam.fits.Header hdr)
hdr
- the Header
public static void mappableWarning(DataSource datsrc) throws java.io.IOException
datsrc
- data source containing FITS
java.io.IOException
public static void addTrimmedValue(nom.tam.fits.Header hdr, java.lang.String key, java.lang.String value, java.lang.String comment) throws nom.tam.fits.HeaderCardException
hdr
- headerkey
- card keyvalue
- card valuecomment
- card comment
nom.tam.fits.HeaderCardException
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |