Interface BlockCompressor

All Known Implementing Classes:
AirBlockCompressor, Lz4BlockCompressor

public interface BlockCompressor
A compressor which compresses a whole byte array each time. It will read from and write to byte arrays given from the outside, reducing copy time.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compress(byte[] src, int srcOff, int srcLen, byte[] dst, int dstOff)
    Compress data read from src, and write the compressed data to dst.
    int
    compress(ByteBuffer src, int srcOff, int srcLen, ByteBuffer dst, int dstOff)
    Compress source data read from (Buffer.position() + srcOff), and write the compressed data to dst.
    int
    getMaxCompressedSize(int srcSize)
    Get the max compressed size for a given original size.
  • Method Details

    • getMaxCompressedSize

      int getMaxCompressedSize(int srcSize)
      Get the max compressed size for a given original size.
    • compress

      int compress(ByteBuffer src, int srcOff, int srcLen, ByteBuffer dst, int dstOff) throws BufferCompressionException
      Compress source data read from (Buffer.position() + srcOff), and write the compressed data to dst.
      Parameters:
      src - Uncompressed data to read from
      srcOff - The start offset of uncompressed data
      srcLen - The length of data which want to be compressed
      dst - The target to write compressed data
      dstOff - The start offset to write the compressed data
      Returns:
      Length of compressed data
      Throws:
      BufferCompressionException - if exception thrown when compressing
    • compress

      int compress(byte[] src, int srcOff, int srcLen, byte[] dst, int dstOff) throws BufferCompressionException
      Compress data read from src, and write the compressed data to dst.
      Parameters:
      src - Uncompressed data to read from
      srcOff - The start offset of uncompressed data
      srcLen - The length of data which want to be compressed
      dst - The target to write compressed data
      dstOff - The start offset to write the compressed data
      Returns:
      Length of compressed data
      Throws:
      BufferCompressionException - if exception thrown when compressing