Package nom.tam.fits
Class FitsFactory
- java.lang.Object
-
- nom.tam.fits.FitsFactory
-
public final class FitsFactory extends java.lang.ObjectThis 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 Modifier and Type Class Description protected static classFitsFactory.FitsSettings
-
Field Summary
Fields Modifier and Type Field Description static intFITS_BLOCK_SIZEprivate static FitsFactory.FitsSettingsGLOBAL_SETTINGSprivate static java.lang.ThreadLocal<FitsFactory.FitsSettings>LOCAL_SETTINGSprivate static java.util.concurrent.ExecutorServicethreadPool
-
Constructor Summary
Constructors Modifier Constructor Description privateFitsFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static FitsFactory.FitsSettingscurrent()static DatadataFactory(Header hdr)static booleangetAllowTerminalJunk()(package private) static booleangetCheckAsciiStrings()static IHierarchKeyFormattergetHierarchFormater()static booleangetUseHierarch()static BasicHDU<?>hduFactory(java.lang.Object o)static <DataClass extends Data>
BasicHDU<DataClass>hduFactory(Header hdr, DataClass d)static BasicHDU<?>HDUFactory(java.lang.Object o)Deprecated.usehduFactory(Object)insteadstatic <DataClass extends Data>
BasicHDU<DataClass>HDUFactory(Header hdr, DataClass d)Deprecated.usehduFactory(Header, Data)insteadprivate static voidinitializeThreadPool()static booleanisLongStringsEnabled()static booleanisSkipBlankAfterAssign()static voidsetAllowTerminalJunk(boolean allowTerminalJunk)Do we allow junk after a valid FITS file?static voidsetCheckAsciiStrings(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 voidsetHierarchFormater(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 voidsetLongStringsEnabled(boolean longStringsEnabled)Enable/Disable longstring support.static voidsetSkipBlankAfterAssign(boolean skipBlankAfterAssign)If set to true the blank after the assign in the header cards in not written.static voidsetUseAsciiTables(boolean useAsciiTables)Indicate whether ASCII tables should be used where feasible.static voidsetUseHierarch(boolean useHierarch)Enable/Disable hierarchical keyword processing.static java.util.concurrent.ExecutorServicethreadPool()static voiduseThreadLocalSettings(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 Detail
-
GLOBAL_SETTINGS
private static final FitsFactory.FitsSettings GLOBAL_SETTINGS
-
LOCAL_SETTINGS
private static final java.lang.ThreadLocal<FitsFactory.FitsSettings> LOCAL_SETTINGS
-
threadPool
private static java.util.concurrent.ExecutorService threadPool
-
FITS_BLOCK_SIZE
public static final int FITS_BLOCK_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
dataFactory
public static Data dataFactory(Header hdr) throws FitsException
- 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
public static IHierarchKeyFormatter getHierarchFormater()
- Returns:
- the formatter to use for hierarch keys.
-
getUseHierarch
public static boolean getUseHierarch()
- Returns:
trueif 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
public static BasicHDU<?> hduFactory(java.lang.Object o) throws FitsException
- 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 public static BasicHDU<?> HDUFactory(java.lang.Object o) throws FitsException
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:
trueIf long string support is enabled.
-
isSkipBlankAfterAssign
public static boolean isSkipBlankAfterAssign()
- Returns:
trueIf 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
public 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. 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
public static java.util.concurrent.ExecutorService 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
protected static FitsFactory.FitsSettings current()
-
getCheckAsciiStrings
static boolean getCheckAsciiStrings()
- Returns:
- Get the current status for string checking.
-
-