Package nom.tam.util

Class FitsDecoder

Direct Known Subclasses:
BufferDecoder

public class FitsDecoder extends InputDecoder
Decodes FITS-formatted binary data into Java arrays (primarily for internal use)
Since:
1.16
See Also:
  • Constructor Details

    • FitsDecoder

      public FitsDecoder(InputReader i)
      Instantiates a new FITS binary data decoder for converting FITS data representations into Java arrays.
      Parameters:
      i - the FITS input.
  • Method Details

    • booleanFor

      public static final boolean booleanFor(int c)
      Gets the boolean equivalent for a FITS byte value representing a logical value. This call does not support null values, which are allowed by the FITS standard, but the similar booleanObjectFor(int) does. FITS defines 'T' as true, 'F' as false, and 0 as null. However, prior versions of this library have used the value 1 for true, and 0 for false. Therefore, this implementation will recognise both 'T' and 1 as true, and will return false for all other byte values.
      Parameters:
      c - The FITS byte that defines a boolean value
      Returns:
      true if and only if the byte is the ASCII character 'T' or has the value of 1, otherwise false.
      See Also:
    • booleanObjectFor

      public static final Boolean booleanObjectFor(int c)
      Gets the boolean equivalent for a FITS byte value representing a logical value. This call supports null values, which are allowed by the FITS standard. FITS defines 'T' as true, 'F' as false, and 0 as null. Prior versions of this library have used the value 1 for true, and 0 for false. Therefore, this implementation will recognise both 'T' and 1 as true, but 0 will map to null and everything else will return false.
      Parameters:
      c - The FITS byte that defines a boolean value
      Returns:
      true if and only if the byte is the ASCII character 'T' or has the value of 1, null it the byte is 0, otherwise false.
      See Also:
    • readArray

      public long readArray(Object o) throws IOException, IllegalArgumentException
      Description copied from class: InputDecoder
      Specified by:
      readArray in class InputDecoder
      Parameters:
      o - an array, to be populated
      Returns:
      the actual number of bytes read from the input, or -1 if already at the end-of-file.
      Throws:
      IOException - if there was an IO error reading from the input
      IllegalArgumentException - if the argument is not an array or if it contains an element that is not supported for decoding.
      See Also: