Package nom.tam.util

Class OutputEncoder

java.lang.Object
nom.tam.util.OutputEncoder
Direct Known Subclasses:
FitsEncoder

public abstract class OutputEncoder extends Object
Efficient base class for encoding Java arrays into binary output (primarily for internal use)
Since:
1.16
Author:
Attila Kovacs
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new Java-to-binary encoder for arrays, writing encoded data to the specified output.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the number of encoded bytes that were written to the output.
    abstract void
    Writes the contents of a Java array to the output translating the data to the required binary representation.

    Methods inherited from class java.lang.Object

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

    • OutputEncoder

      public OutputEncoder(OutputWriter o)
      Instantiates a new Java-to-binary encoder for arrays, writing encoded data to the specified output.
      Parameters:
      o - the output to which encoded data is to be written.
  • Method Details

    • getCount

      public long getCount()
      Returns the number of encoded bytes that were written to the output. It does not include bytes written directly (unencoded) to the output, such as via write(int) or write(byte[], int, int).
      Returns:
      the number of encoded bytes written to the output.
      See Also:
    • writeArray

      public abstract void writeArray(Object o) throws IOException, IllegalArgumentException
      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.
      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: