Interface PageCompressor
- All Superinterfaces:
AutoCloseable
,Closeable
Compresses and decompresses pages. Instances aren't expected to be thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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.static Supplier
<PageCompressor> lz4()
Returns a supplier of new LZ4 compressors.static Supplier
<PageCompressor> zlib()
Returns a supplier of new ZLIB compressors (deflate).static Supplier
<PageCompressor> zlib
(int level) Returns a supplier of new ZLIB compressors (deflate).
-
Method Details
-
zlib
Returns a supplier of new ZLIB compressors (deflate). -
zlib
Returns a supplier of new ZLIB compressors (deflate).- Parameters:
level
- compression level [0..9]
-
lz4
Returns a supplier of new LZ4 compressors. -
compress
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-