Package nom.tam.fits

Class FitsFactory


  • public final class FitsFactory
    extends java.lang.Object
    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.
    • 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:
        true if we are processing HIERARCH style keywords
      • hduFactory

        public static <DataClass extends DataBasicHDU<DataClass> hduFactory​(Header hdr,
                                                                              DataClass d)
                                                                       throws FitsException
        Type Parameters:
        DataClass - the class of the data
        Parameters:
        hdr - the header of the date
        d - 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 DataBasicHDU<DataClass> HDUFactory​(Header hdr,
                                                                              DataClass d)
                                                                       throws FitsException
        Deprecated.
        Type Parameters:
        DataClass - the class of the data
        Parameters:
        hdr - the header of the date
        d - 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.
        use hduFactory(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

        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.