|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eap.fits.FitsCard
Represents a single header record. It's called a "card" because when FITS was created, FORTRAN was the standard programming language for science and the designers had punchcards in mind. A card consists of 80 ASCII characters containing a key/value pair and a comment. The internal structure of a card is not parsed until needed. You may construct a new card by specifying its raw bytes or by specifying it's component fields. In the former case the bytes are taken without question, and in the latter case, the constructor forces correct FITS format.
Field Summary | |
static int |
CARDS_PER_BLOCK
the number of cards in a FITS block = 2880/80 |
static int |
KEY_LENGTH
the maximum number of bytes in a keyword = 8 |
static int |
LENGTH
the number of bytes in a card = 80 |
static byte[] |
PADDING
the value to use for padding out an incomplete block (80 ASCII spaces) |
Constructor Summary | |
FitsCard(byte[] data)
Create a new card initialized with the given data. |
|
FitsCard(byte[] data,
int offset)
Create a new card from the bytes in an array, starting at the given offset into the array. |
|
FitsCard(String key)
Create a card by specifying only its keyword. |
|
FitsCard(String key,
boolean value,
String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(String key,
Boolean value,
String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(String key,
double value,
String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(String key,
float value,
String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(String key,
int value,
String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(String key,
long value,
String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(String key,
Number value,
String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(String key,
String comment)
create a new card which has no value field. |
|
FitsCard(String key,
String value,
String comment)
construct a card by specifying it's keyword, value and comment. |
Method Summary | |
String |
comment()
returns the commment field. |
byte[] |
data()
returns the raw 80 bytes of data for this card. |
double |
doubleValue()
returns a double value, if appropriate |
static String |
formatKeyword(String template)
returns a string which is guaranteed to be a legal FITS keyword. |
int |
intValue()
returns an integer value, if appropriate. |
String |
key()
returns a string containing the keyword for this card |
String |
stringValue()
returns the value of the card as a string. |
String |
toString()
returns the raw bytes of the card converted to a string and with trailing white space removed. |
Object |
value()
returns an object representing the value field. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int LENGTH
public static final int KEY_LENGTH
public static final int CARDS_PER_BLOCK
public static final byte[] PADDING
Constructor Detail |
public FitsCard(byte[] data)
data
- an array of at least 80 bytes
ArrayIndexOutOfBoundsException
- if the byte array does not
have at least 80 bytes in it.public FitsCard(byte[] data, int offset)
data
- an array of bytes to use for the card data.offset
- the offset into the array at which to start reading data.
an offset of "0" means read from the beginning of the array
ArrayIndexOutOfBoundsException
- if the data array does not contain
enough bytes.public FitsCard(String key)
key
- the keyword for this card.public FitsCard(String key, String comment)
key
- the keyword for the cardcomment
- the comment field for this card.public FitsCard(String key, String value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.public FitsCard(String key, boolean value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.public FitsCard(String key, Boolean value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.public FitsCard(String key, int value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.public FitsCard(String key, long value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.public FitsCard(String key, float value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.public FitsCard(String key, double value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.public FitsCard(String key, Number value, String comment)
key
- the keyword for the cardvalue
- the value of the keywordcomment
- the comment field for this card.Method Detail |
public byte[] data()
public String key()
public Object value() throws eap.fits.FitsCardException
FitsCardException
- if the raw data are not properly formattedpublic int intValue() throws eap.fits.FitsCardException
ClassCastException
- if the card does not have a numerical value
NullPointerException
- if the card has no value
eap.fits.FitsCardException
public double doubleValue() throws eap.fits.FitsCardException
ClassCastException
- if the card does not have a numerical value
NullPointerException
- if the card has no value
eap.fits.FitsCardException
public String stringValue() throws eap.fits.FitsCardException
FitsCardException
- if the raw data are not properly formattedpublic String comment() throws eap.fits.FitsCardException
FitsCardException
- if the raw data are not properly formatted.public String toString()
public static String formatKeyword(String template)
template
- the intended keyword
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |