Package nom.tam.util

Class FitsEncoder

Direct Known Subclasses:
BufferEncoder

public class FitsEncoder extends OutputEncoder
Encodes select Java arrays into FITS binary format (primarily for internal use)
Since:
1.16
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new FITS binary data encoder for converting Java arrays into FITS data representations
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte
    Returns the FITS byte value representing a logical value.
    static long
    Returns the size of this object as the number of bytes in a FITS binary representation.
    void
    Writes the contents of a Java array to the output translating the data to the required binary representation.

    Methods inherited from class nom.tam.util.OutputEncoder

    getCount

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FitsEncoder

      public FitsEncoder(OutputWriter o)
      Instantiates a new FITS binary data encoder for converting Java arrays into FITS data representations
      Parameters:
      o - the FITS output.
  • Method Details

    • byteForBoolean

      public static byte byteForBoolean(Boolean b)
      Returns the 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:
      b - A java boolean value or null
      Returns:
      the FITS byte representation of a boolean value.
    • writeArray

      public void writeArray(Object o) throws IOException, IllegalArgumentException
      Description copied from class: OutputEncoder
      Writes the contents of a Java array to the output translating the data to the required binary representation. The argument may be any generic Java array, including heterogeneous arrays of arrays.
      Specified by:
      writeArray in class OutputEncoder
      Parameters:
      o - the Java array, including heterogeneous arrays of arrays. If null nothing will be written to the output.
      Throws:
      IOException - if there was an IO error writing to the output
      IllegalArgumentException - if the supplied object is not a Java array or if it contains Java types that are not supported by the decoder.
      See Also:
    • computeSize

      public static long computeSize(Object o)
      Returns the size of this object as the number of bytes in a FITS binary representation.
      Parameters:
      o - the object
      Returns:
      the number of bytes in the FITS binary representation of the object or 0 if the object has no FITS representation. (Also elements not known to FITS will count as 0 sized).