Package nom.tam.util

Class BufferDecoder


@Deprecated public abstract class BufferDecoder extends FitsDecoder
Deprecated.
Use FitsDecoder instead which provides a similar function but in a more consistent way and with a less misleading name. This is a rusty rail implementation for of an older abandoned class only, unsafe for general use. For reading non-FITS encoding you may also use InputDecoder as a base for implementing efficient custom decoding of binary inputs in general.
See Also:
  • Constructor Details

    • BufferDecoder

      public BufferDecoder(BufferPointer p)
      Deprecated.
      Parameters:
      p - Unused, but the position and length fields are set/reset as to pretend that half of the buffer is perpetually available for reading. However, at no point will there be any data actually in the buffer of this object, and you should by all means avoid directly loading data from the stream into this dead-end buffer, other than the hopefully untiggered existing implementation of checkBuffer(int) (and it's safest if you don't override or ever call checkBuffer(int) from your code!).
  • Method Details

    • checkBuffer

      @Deprecated protected void checkBuffer(int needBytes) throws IOException
      Deprecated.
      No longer used internally, kept only for back-compatibility since it used to be a needed abstract method. It's safest if you never override or call this method from your code!
      Parameters:
      needBytes - the number of byte we need available to decode the next element
      Throws:
      IOException - if the data could not be made available due to an IO error of the underlying input.
    • read

      protected int read(byte[] buf, int offset, int length) throws IOException
      Deprecated.
      Description copied from class: InputDecoder
      Reads bytes into an array from the input. See the contract of InputStream.read(byte[], int, int).
      Overrides:
      read in class InputDecoder
      Parameters:
      buf - the destination array
      offset - the first index in the array to be populated
      length - the number of bytes to read into the array.
      Returns:
      the number of bytes successfully read, or -1 if at the end of the file.
      Throws:
      IOException - if an IO error, other than the end-of-file prevented the read.
    • eofCheck

      @Deprecated protected int eofCheck(EOFException e, int start, int index, int elementSize) throws EOFException
      Deprecated.
      No longer used internally, kept only for back-compatibility since it used to be a needed abstract method.
      Parameters:
      e - the EOFException thrown by one of the read calls.
      start - the index of the first array element we wanted to fill
      index - the array index of the element during which the exception was thrown
      elementSize - the number of bytes per element we were processing
      Returns:
      the numer of bytes successfully processed from the input before the exception occurred.
      Throws:
      EOFException - if the input had no more data to process
    • readLArray

      protected long readLArray(Object o) throws IOException
      Deprecated.
      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:
      IllegalArgumentException - if the argument is not an array or if it contains an element that is not supported for decoding.
      IOException - if there was an IO error reading from the input