Package nom.tam.fits
Class FitsFactory
java.lang.Object
nom.tam.fits.FitsFactory
This class contains the code which associates particular FITS types with
header and data configurations. It comprises a set of Factory methods which
call appropriate methods in the HDU classes. If -- God forbid -- a new FITS
HDU type were created, then the XXHDU, XXData classes would need to be added
and this file modified but no other changes should be needed in the FITS
libraries.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
private static final FitsFactory.FitsSettings
private static final ThreadLocal<FitsFactory.FitsSettings>
private static ExecutorService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static FitsFactory.FitsSettings
current()
static Data
dataFactory
(Header hdr) static boolean
(package private) static boolean
static IHierarchKeyFormatter
static boolean
static BasicHDU<?>
hduFactory
(Object o) hduFactory
(Header hdr, DataClass d) static BasicHDU<?>
HDUFactory
(Object o) Deprecated.HDUFactory
(Header hdr, DataClass d) Deprecated.usehduFactory(Header, Data)
insteadprivate static void
static boolean
static boolean
static void
setAllowTerminalJunk
(boolean allowTerminalJunk) Do we allow junk after a valid FITS file?static void
setCheckAsciiStrings
(boolean checkAsciiStrings) Enable/Disable checking of strings values used in tables to ensure that they are within the range specified by the FITS standard.static void
setHierarchFormater
(IHierarchKeyFormatter formatter) There is not a real standard how to write hierarch keys, default we use the one where every key is separated by a blank.static void
setLongStringsEnabled
(boolean longStringsEnabled) Enable/Disable longstring support.static void
setSkipBlankAfterAssign
(boolean skipBlankAfterAssign) If set to true the blank after the assign in the header cards in not written.static void
setUseAsciiTables
(boolean useAsciiTables) Indicate whether ASCII tables should be used where feasible.static void
setUseHierarch
(boolean useHierarch) Enable/Disable hierarchical keyword processing.static ExecutorService
static void
useThreadLocalSettings
(boolean useThreadSettings) Use thread local settings for the current thread instead of the global ones if the parameter is set to true, else use the shared global settings.
-
Field Details
-
GLOBAL_SETTINGS
-
LOCAL_SETTINGS
-
threadPool
-
FITS_BLOCK_SIZE
public static final int FITS_BLOCK_SIZE- See Also:
-
-
Constructor Details
-
FitsFactory
private FitsFactory()
-
-
Method Details
-
dataFactory
- Parameters:
hdr
- header to create the data from- Returns:
- Given a Header construct an appropriate data.
- Throws:
FitsException
- if the header did not contain enough information to detect the type of the data
-
getAllowTerminalJunk
public static boolean getAllowTerminalJunk()- Returns:
- Is terminal junk (i.e., non-FITS data following a valid HDU) allowed.
-
getHierarchFormater
- Returns:
- the formatter to use for hierarch keys.
-
getUseHierarch
public static boolean getUseHierarch()- Returns:
true
if we are processing HIERARCH style keywords
-
hduFactory
public static <DataClass extends Data> BasicHDU<DataClass> hduFactory(Header hdr, DataClass d) throws FitsException - Type Parameters:
DataClass
- the class of the data- Parameters:
hdr
- the header of the dated
- the data- Returns:
- Given Header and data objects return the appropriate type of HDU.
- Throws:
FitsException
- if the operation failed
-
hduFactory
- Parameters:
o
- The object to be described.- Returns:
- Given an object, create the appropriate FITS header to describe it.
- Throws:
FitsException
- if the parameter could not be converted to a hdu.
-
HDUFactory
@Deprecated public static <DataClass extends Data> BasicHDU<DataClass> HDUFactory(Header hdr, DataClass d) throws FitsException Deprecated.usehduFactory(Header, Data)
instead- Type Parameters:
DataClass
- the class of the data- Parameters:
hdr
- the header of the dated
- the data- Returns:
- Given Header and data objects return the appropriate type of HDU.
- Throws:
FitsException
- if the operation failed
-
HDUFactory
Deprecated.usehduFactory(Object)
instead- Parameters:
o
- The object to be described.- Returns:
- Given an object, create the appropriate FITS header to describe it.
- Throws:
FitsException
- if the parameter could not be converted to a hdu.
-
isLongStringsEnabled
public static boolean isLongStringsEnabled()- Returns:
true
If long string support is enabled.
-
isSkipBlankAfterAssign
public static boolean isSkipBlankAfterAssign()- Returns:
true
If blanks after the assign are ommitted in the header.
-
setAllowTerminalJunk
public static void setAllowTerminalJunk(boolean allowTerminalJunk) Do we allow junk after a valid FITS file?- Parameters:
allowTerminalJunk
- value to set
-
setCheckAsciiStrings
public static void setCheckAsciiStrings(boolean checkAsciiStrings) Enable/Disable checking of strings values used in tables to ensure that they are within the range specified by the FITS standard. The standard only allows the values 0x20 - 0x7E with null bytes allowed in one limited context. Disabled by default.- Parameters:
checkAsciiStrings
- value to set
-
setHierarchFormater
There is not a real standard how to write hierarch keys, default we use the one where every key is separated by a blank. If you want or need another format assing the formater here.- Parameters:
formatter
- the hierarch key formatter.
-
setLongStringsEnabled
public static void setLongStringsEnabled(boolean longStringsEnabled) Enable/Disable longstring support.- Parameters:
longStringsEnabled
- value to set
-
setSkipBlankAfterAssign
public static void setSkipBlankAfterAssign(boolean skipBlankAfterAssign) If set to true the blank after the assign in the header cards in not written. The blank is stronly recommendet but in some cases it is important that it can be ommitted.- Parameters:
skipBlankAfterAssign
- value to set
-
setUseAsciiTables
public static void setUseAsciiTables(boolean useAsciiTables) Indicate whether ASCII tables should be used where feasible.- Parameters:
useAsciiTables
- value to set
-
setUseHierarch
public static void setUseHierarch(boolean useHierarch) Enable/Disable hierarchical keyword processing.- Parameters:
useHierarch
- value to set
-
threadPool
-
useThreadLocalSettings
public static void useThreadLocalSettings(boolean useThreadSettings) Use thread local settings for the current thread instead of the global ones if the parameter is set to true, else use the shared global settings.- Parameters:
useThreadSettings
- true if the thread should not share the global settings.
-
initializeThreadPool
private static void initializeThreadPool() -
current
-
getCheckAsciiStrings
static boolean getCheckAsciiStrings()- Returns:
- Get the current status for string checking.
-
hduFactory(Object)
instead