|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.io.fits.FitsCard
public class 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(java.lang.String key)
Create a card by specifying only its keyword. |
|
FitsCard(java.lang.String key,
boolean value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(java.lang.String key,
java.lang.Boolean value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(java.lang.String key,
double value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(java.lang.String key,
float value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(java.lang.String key,
int value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(java.lang.String key,
long value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(java.lang.String key,
java.lang.Number value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
FitsCard(java.lang.String key,
java.lang.String comment)
create a new card which has no value field. |
|
FitsCard(java.lang.String key,
java.lang.String value,
java.lang.String comment)
construct a card by specifying it's keyword, value and comment. |
|
| Method Summary | |
|---|---|
java.lang.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 java.lang.String |
formatKeyword(java.lang.String template)
returns a string which is guaranteed to be a legal FITS keyword. |
int |
intValue()
returns an integer value, if appropriate. |
java.lang.String |
key()
returns a string containing the keyword for this card |
java.lang.String |
stringValue()
returns the value of the card as a string. |
java.lang.String |
toString()
returns the raw bytes of the card converted to a string and with trailing white space removed. |
java.lang.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
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 arraypublic FitsCard(java.lang.String key)
key - the keyword for this card.
public FitsCard(java.lang.String key,
java.lang.String comment)
key - the keyword for the cardcomment - the comment field for this card.
public FitsCard(java.lang.String key,
java.lang.String value,
java.lang.String comment)
key - the keyword for the cardvalue - the value of the keywordcomment - the comment field for this card.
public FitsCard(java.lang.String key,
boolean value,
java.lang.String comment)
key - the keyword for the cardvalue - the value of the keywordcomment - the comment field for this card.
public FitsCard(java.lang.String key,
java.lang.Boolean value,
java.lang.String comment)
key - the keyword for the cardvalue - the value of the keywordcomment - the comment field for this card.
public FitsCard(java.lang.String key,
int value,
java.lang.String comment)
key - the keyword for the cardvalue - the value of the keywordcomment - the comment field for this card.
public FitsCard(java.lang.String key,
long value,
java.lang.String comment)
key - the keyword for the cardvalue - the value of the keywordcomment - the comment field for this card.
public FitsCard(java.lang.String key,
float value,
java.lang.String comment)
key - the keyword for the cardvalue - the value of the keywordcomment - the comment field for this card.
public FitsCard(java.lang.String key,
double value,
java.lang.String comment)
key - the keyword for the cardvalue - the value of the keywordcomment - the comment field for this card.
public FitsCard(java.lang.String key,
java.lang.Number value,
java.lang.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 java.lang.String key()
public java.lang.Object value()
throws org.jscience.io.fits.FitsCardException
FitsCardException - if the raw data are not properly formatted
public int intValue()
throws org.jscience.io.fits.FitsCardException
FitsCardException - if the card does not have a numerical value
public double doubleValue()
throws org.jscience.io.fits.FitsCardException
FitsCardException - if the card does not have a numerical value
public java.lang.String stringValue()
throws org.jscience.io.fits.FitsCardException
FitsCardException - if the raw data are not properly formatted
public java.lang.String comment()
throws org.jscience.io.fits.FitsCardException
FitsCardException - if the raw data are not properly formatted.public java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String formatKeyword(java.lang.String template)
template - the intended keyword
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||