Class Lz4BlockDecompressor

  • All Implemented Interfaces:
    BlockDecompressor

    public class Lz4BlockDecompressor
    extends Object
    implements BlockDecompressor
    Decode data written with Lz4BlockCompressor. It reads from and writes to byte arrays provided from the outside, thus reducing copy time.

    This class is copied and modified from LZ4BlockInputStream.

    • Constructor Detail

      • Lz4BlockDecompressor

        public Lz4BlockDecompressor()
    • Method Detail

      • decompress

        public int decompress​(ByteBuffer src,
                              int srcOff,
                              int srcLen,
                              ByteBuffer dst,
                              int dstOff)
                       throws BufferDecompressionException
        Description copied from interface: BlockDecompressor
        Decompress source data read from (Buffer.position() + srcOff), and write the decompressed data to dst.
        Specified by:
        decompress in interface BlockDecompressor
        Parameters:
        src - Compressed data to read from
        srcOff - The start offset of compressed data
        srcLen - The length of data which want to be decompressed
        dst - The target to write decompressed data
        dstOff - The start offset to write the decompressed data
        Returns:
        Length of decompressed data
        Throws:
        BufferDecompressionException - if exception thrown when decompressing
      • decompress

        public int decompress​(byte[] src,
                              int srcOff,
                              int srcLen,
                              byte[] dst,
                              int dstOff)
                       throws BufferDecompressionException
        Description copied from interface: BlockDecompressor
        Decompress source data read from src and write the decompressed data to dst.
        Specified by:
        decompress in interface BlockDecompressor
        Parameters:
        src - Compressed data to read from
        srcOff - The start offset of compressed data
        srcLen - The length of data which want to be decompressed
        dst - The target to write decompressed data
        dstOff - The start offset to write the decompressed data
        Returns:
        Length of decompressed data
        Throws:
        BufferDecompressionException - if exception thrown when decompressing