Package uk.ac.starlink.fits
Interface CardFactory.Config
- Enclosing class:
CardFactory
public static interface CardFactory.Config
CardFactory configuration.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines whether the HIERARCH keyword convention is permitted.boolean
Determines whether overlength string values will be trimmed to fits card constraints.sanitiseText
(String txt) This method is called on uncontrolled text inputs that will end up as text or comment content in output cards.
-
Method Details
-
allowHierarch
boolean allowHierarch()Determines whether the HIERARCH keyword convention is permitted. If true, overlength keywords starting "HIERARCH " are allowed.- Returns:
- true iff HIERARCH is allowed
-
allowTrim
boolean allowTrim()Determines whether overlength string values will be trimmed to fits card constraints. If true, strings will be silently truncated, if false overlength values will provoke a RuntimeException.- Returns:
- true iff overlength string values may be truncated
-
sanitiseText
This method is called on uncontrolled text inputs that will end up as text or comment content in output cards. The output value must contain only legal FITS header characters, that is in the range 0x20-0x7e inclusive (seeFitsUtil.isFitsCharacter(int)
). If the input text contains no illegal characters, it should be returned unchanged. If it does contain illegal characters, it should be adjusted in some way to remove them, or a RuntimeException may be thrown.Example implementations are provided in
sanitiseAsReplacement
andsanitiseAsError
.- Parameters:
txt
- non-null free text string- Returns:
- string like input but containing only legal FITS characters
- Throws:
IllegalArgumentException
- if this config is unable or unwilling to sanitise
-