Class FitsHeaderCardParser
java.lang.Object
nom.tam.fits.utilities.FitsHeaderCardParser
A helper utility class to parse header cards for there value (especially
strings) and comments.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classvalue comment pair of the header card. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateutility class will not be instantiated. -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringdeleteQuotes(String quotedString) delete the start and trailing quote from the sting and replace all (escaped)double quotes with a single quote.private static StringextractComment(String stringCard, int startPosition) get the not empty comment string from the end of the card.static StringparseCardKey(String card) parse a fits keyword from a card and return it as a dot separated list.parseCardValue(String card) Parse the card for a value and comment.private static FitsHeaderCardParser.ParsedValueparseStringValue(String card) lets see if there is a quoted sting in the card.
-
Field Details
-
KEYWORD_PATTERN
pattern to match FITS keywords, specially to parse hirarchical keywords. -
STRING_PATTERN
pattern to match a quoted string where 2 quotes are used to escape a single quote inside the string. Attention this patern ist optimized as specified in http://www.perlmonks.org/?node_id=607740
-
-
Constructor Details
-
FitsHeaderCardParser
private FitsHeaderCardParser()utility class will not be instantiated.
-
-
Method Details
-
deleteQuotes
-
extractComment
get the not empty comment string from the end of the card. start scanning from the end of the value.- Parameters:
stringCard- the string representing the cardstartPosition- the start point for the scan- Returns:
- the not empty comment or null if no comment was found.
-
parseCardKey
-
parseCardValue
Parse the card for a value and comment. Quoted string values are unquoted and theFitsHeaderCardParser.ParsedValue.isStringspecifies if the value was a quoted string. non quoted values are trimmed.- Parameters:
card- the card to parse.- Returns:
- a parsed card or null if no value could be detected.
-
parseStringValue
lets see if there is a quoted sting in the card.- Parameters:
card- the card string to parse.- Returns:
- the parsed value with the unquoted string or null if no quoted string was found.
-