Interface PageCompressor

All Superinterfaces:
AutoCloseable, Closeable

public interface PageCompressor extends Closeable
Compresses and decompresses pages. Instances aren't expected to be thread-safe.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
    compress(long srcAddr, int srcOff, int srcLen)
    Compress to a byte array from a raw memory address.
    byte[]
    Target of the compress method.
    void
    decompress(byte[] src, int srcOff, int srcLen, long dstAddr, int dstOff, int dstLen)
    Decompress to a raw memory address.
    lz4()
    Returns a supplier of new LZ4 compressors.
    Returns a supplier of new ZLIB compressors (deflate).
    zlib(int level)
    Returns a supplier of new ZLIB compressors (deflate).
  • Method Details

    • zlib

      static Supplier<PageCompressor> zlib()
      Returns a supplier of new ZLIB compressors (deflate).
    • zlib

      static Supplier<PageCompressor> zlib(int level)
      Returns a supplier of new ZLIB compressors (deflate).
      Parameters:
      level - compression level [0..9]
    • lz4

      static Supplier<PageCompressor> lz4()
      Returns a supplier of new LZ4 compressors.
    • compress

      int compress(long srcAddr, int srcOff, int srcLen) throws IOException
      Compress to a byte array from a raw memory address.
      Returns:
      the compressed size
      Throws:
      IOException
    • compressedBytes

      byte[] compressedBytes()
      Target of the compress method. The array is recycled, although it can be replaced.
    • decompress

      void decompress(byte[] src, int srcOff, int srcLen, long dstAddr, int dstOff, int dstLen) throws IOException
      Decompress to a raw memory address.
      Parameters:
      dstLen - original size of uncompressed page
      Throws:
      IOException
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable