Class GZipCompressor<T extends Buffer>

java.lang.Object
nom.tam.fits.compression.algorithm.gzip.GZipCompressor<T>
Type Parameters:
T - The genetic type of element buffer to compress
All Implemented Interfaces:
ICompressor<T>
Direct Known Subclasses:
GZip2Compressor, GZipCompressor.ByteGZipCompressor, GZipCompressor.DoubleGZipCompressor, GZipCompressor.FloatGZipCompressor, GZipCompressor.IntGZipCompressor, GZipCompressor.LongGZipCompressor, GZipCompressor.ShortGZipCompressor

public abstract class GZipCompressor<T extends Buffer> extends Object implements ICompressor<T>
(for internal use) The GZIP compression algorithm.
  • Field Details

    • primitiveSize

      protected final int primitiveSize
    • buffer

      protected byte[] buffer
    • nioBuffer

      protected T extends Buffer nioBuffer
  • Constructor Details

    • GZipCompressor

      public GZipCompressor(int primitiveSize)
  • Method Details

    • compress

      public boolean compress(T pixelData, ByteBuffer compressed)
      Description copied from interface: ICompressor
      compress the buffer into the byte buffer. Attention enough space must already be allocated.
      Specified by:
      compress in interface ICompressor<T extends Buffer>
      Parameters:
      pixelData - the buffer to compress.
      compressed - the compressed data
      Returns:
      true if the compression succeeded.
    • decompress

      public void decompress(ByteBuffer compressed, T pixelData)
      Description copied from interface: ICompressor
      Decompress the byte buffer and restore the buffer from it, again enough space must already be allocated.
      Specified by:
      decompress in interface ICompressor<T extends Buffer>
      Parameters:
      compressed - the compressed data
      pixelData - the buffer to fill with the uncompressed data.
    • createGZipInputStream

      protected GZIPInputStream createGZipInputStream(ByteBuffer compressed) throws IOException
      Throws:
      IOException
    • createGZipOutputStream

      protected GZIPOutputStream createGZipOutputStream(int length, ByteBuffer compressed) throws IOException
      Throws:
      IOException
    • getPixel

      protected abstract void getPixel(T pixelData, byte[] pixelBytes)
    • setPixel

      protected abstract void setPixel(T pixelData, byte[] pixelBytes)