Class GZipCompressor<T extends java.nio.Buffer>

    • Field Detail

      • DEFAULT_GZIP_BUFFER_SIZE

        private static final int DEFAULT_GZIP_BUFFER_SIZE
        See Also:
        Constant Field Values
      • MINIMAL_GZIP_BUFFER_SIZE

        private static final int MINIMAL_GZIP_BUFFER_SIZE
        See Also:
        Constant Field Values
      • primitiveSize

        protected final int primitiveSize
      • buffer

        protected byte[] buffer
      • nioBuffer

        protected T extends java.nio.Buffer nioBuffer
      • sizeArray

        private final byte[] sizeArray
      • sizeBuffer

        private final java.nio.IntBuffer sizeBuffer
    • Constructor Detail

      • GZipCompressor

        public GZipCompressor​(int primitiveSize)
    • Method Detail

      • compress

        public boolean compress​(T pixelData,
                                java.nio.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 java.nio.Buffer>
        Parameters:
        pixelData - the buffer to compress.
        compressed - the compressed data
        Returns:
        true if the compression succeeded.
      • decompress

        public void decompress​(java.nio.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 java.nio.Buffer>
        Parameters:
        compressed - the compressed data
        pixelData - the buffer to fill with the uncompressed data.
      • getPrimitiveType

        private <B extends java.nio.Buffer> PrimitiveType<B> getPrimitiveType​(int size)
      • getTypeConverter

        private GZipCompressor.TypeConversion<java.nio.Buffer> getTypeConverter​(java.nio.ByteBuffer compressed,
                                                                                int nrOfPrimitiveElements)
      • createGZipInputStream

        protected java.util.zip.GZIPInputStream createGZipInputStream​(java.nio.ByteBuffer compressed)
                                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • createGZipOutputStream

        protected java.util.zip.GZIPOutputStream createGZipOutputStream​(int length,
                                                                        java.nio.ByteBuffer compressed)
                                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getPixel

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

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