public class HeaderCard extends Object implements CursorValue<String>
Modifier and Type | Field and Description |
---|---|
static int |
FITS_HEADER_CARD_SIZE |
static int |
MAX_KEYWORD_LENGTH
Maximum length of a FITS keyword field
|
static int |
MAX_LONG_STRING_CONTINUE_OVERHEAD
the start and end quotes of the string and the ampasant to continue the
string.
|
static int |
MAX_LONG_STRING_VALUE_LENGTH
Maximum length of a FITS long string value field.
|
static int |
MAX_LONG_STRING_VALUE_WITH_COMMENT_LENGTH
if a commend needs the be specified 2 extra chars are needed to start the
comment
|
static int |
MAX_STRING_VALUE_LENGTH
Maximum length of a FITS string value field.
|
static int |
MAX_VALUE_LENGTH
Maximum length of a FITS value field.
|
Constructor and Description |
---|
HeaderCard(ArrayDataInput dis) |
HeaderCard(HeaderCardCountingArrayDataInput dis) |
HeaderCard(String key,
BigDecimal value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
BigInteger value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
boolean value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
double value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
float value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
int value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
long value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
String comment,
boolean nullable)
Create a comment style card.
|
HeaderCard(String key,
String value,
String comment)
Create a HeaderCard from its component parts
|
HeaderCard(String key,
String value,
String comment,
boolean nullable)
Create a HeaderCard from its component parts
|
Modifier and Type | Method and Description |
---|---|
int |
cardSize() |
HeaderCard |
copy() |
static HeaderCard |
create(String card) |
String |
getComment() |
String |
getKey() |
String |
getValue() |
<T> T |
getValue(Class<T> clazz,
T defaultValue) |
boolean |
isKeyValuePair() |
boolean |
isStringValue() |
protected static HeaderCard |
saveNewHeaderCard(String key,
String comment,
boolean isString)
This method is only used internally when it is sure that the creation of
the card is granted not to throw an exception
|
void |
setComment(String comment)
set the comment of a card.
|
HeaderCard |
setValue(boolean update)
Set the value for this card.
|
HeaderCard |
setValue(double update)
Set the value for this card.
|
HeaderCard |
setValue(float update)
Set the value for this card.
|
HeaderCard |
setValue(int update)
Set the value for this card.
|
HeaderCard |
setValue(long update)
Set the value for this card.
|
HeaderCard |
setValue(String update)
Set the value for this card.
|
String |
toString()
Return the modulo 80 character card image, the toString tries to preserve
as much as possible of the comment value by reducing the alignment of the
Strings if the comment is longer and if longString is enabled the string
can be split into one more card to have more space for the comment.
|
Class<?> |
valueType() |
public static final int FITS_HEADER_CARD_SIZE
public static final int MAX_KEYWORD_LENGTH
public static final int MAX_LONG_STRING_CONTINUE_OVERHEAD
public static final int MAX_LONG_STRING_VALUE_LENGTH
public static final int MAX_LONG_STRING_VALUE_WITH_COMMENT_LENGTH
public static final int MAX_STRING_VALUE_LENGTH
public static final int MAX_VALUE_LENGTH
public HeaderCard(ArrayDataInput dis) throws TruncatedFileException, IOException
TruncatedFileException
IOException
public HeaderCard(HeaderCardCountingArrayDataInput dis) throws TruncatedFileException, IOException
TruncatedFileException
IOException
public HeaderCard(String key, BigDecimal value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keywordpublic HeaderCard(String key, BigInteger value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keywordpublic HeaderCard(String key, boolean value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keywordpublic HeaderCard(String key, double value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keywordpublic HeaderCard(String key, float value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keywordpublic HeaderCard(String key, int value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keywordpublic HeaderCard(String key, long value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keywordpublic HeaderCard(String key, String comment, boolean nullable) throws HeaderCardException
key
- The key for the comment or nullable field.comment
- The commentnullable
- Is this a nullable field or a comment-style card?HeaderCardException
- for any invalid keyword or valuepublic HeaderCard(String key, String value, String comment) throws HeaderCardException
key
- keyword (null for a comment)value
- value (null for a comment or keyword without an '=')comment
- commentHeaderCardException
- for any invalid keyword or valuepublic HeaderCard(String key, String value, String comment, boolean nullable) throws HeaderCardException
key
- Keyword (null for a COMMENT)value
- Valuecomment
- Commentnullable
- Is this a nullable value card?HeaderCardException
- for any invalid keyword or valuepublic static HeaderCard create(String card)
card
- the 80 character card imagepublic int cardSize()
public HeaderCard copy() throws HeaderCardException
HeaderCardException
public String getComment()
public String getKey()
getKey
in interface CursorValue<String>
public String getValue()
public <T> T getValue(Class<T> clazz, T defaultValue)
T
- the type of the requested classclazz
- the requested class of the valuedefaultValue
- the value if the card was not present.public boolean isKeyValuePair()
public boolean isStringValue()
public void setComment(String comment)
comment
- the comment to set.public HeaderCard setValue(boolean update)
update
- the new value to setpublic HeaderCard setValue(double update)
update
- the new value to setpublic HeaderCard setValue(float update)
update
- the new value to setpublic HeaderCard setValue(int update)
update
- the new value to setpublic HeaderCard setValue(long update)
update
- the new value to setpublic HeaderCard setValue(String update)
update
- the new value to setpublic String toString()
public Class<?> valueType()
protected static HeaderCard saveNewHeaderCard(String key, String comment, boolean isString)
key
- the key for the cardcomment
- the comment for the cardisString
- is this a string value card?Copyright © 1996–2016 nom-tam-fits. All rights reserved.