Class Lz4CompressionCodec

java.lang.Object
org.apache.arrow.vector.compression.AbstractCompressionCodec
org.apache.arrow.compression.Lz4CompressionCodec
All Implemented Interfaces:
CompressionCodec

public class Lz4CompressionCodec extends AbstractCompressionCodec
Compression codec for the LZ4 frame format.

Each buffer is written as one frame of independent blocks of up to 4 MiB, without checksums, which every LZ4 frame decoder reads. Compression, and the decompression of frames whose blocks are independent, use lz4-java on the buffers' memory directly. A frame whose blocks are linked, as Arrow C++ writes for a buffer larger than 64 KiB, or that uses a dictionary, is decompressed with commons-compress, since lz4-java cannot decode a block that refers to earlier ones.

  • Constructor Details

    • Lz4CompressionCodec

      public Lz4CompressionCodec()
  • Method Details

    • doCompress

      protected ArrowBuf doCompress(BufferAllocator allocator, ArrowBuf uncompressedBuffer)
      Description copied from class: AbstractCompressionCodec
      The method that actually performs the data compression. The layout of the returned compressed buffer is the compressed data, plus 8 bytes reserved at the beginning of the buffer for the uncompressed data size.

      Please note that this method is not responsible for releasing the uncompressed buffer.

      Specified by:
      doCompress in class AbstractCompressionCodec
    • doDecompress

      protected ArrowBuf doDecompress(BufferAllocator allocator, ArrowBuf compressedBuffer)
      Description copied from class: AbstractCompressionCodec
      The method that actually performs the data decompression. The layout of the compressed buffer is the compressed data, plus 8 bytes at the beginning of the buffer storing the uncompressed data size.

      Please note that this method is not responsible for releasing the compressed buffer.

      Specified by:
      doDecompress in class AbstractCompressionCodec
    • getCodecType

      public CompressionUtil.CodecType getCodecType()
      Description copied from interface: CompressionCodec
      Gets the type of the codec.
      Returns:
      the type of the codec.