- All Superinterfaces:
AutoCloseable,Closeable
Compresses and decompresses pages. Instances aren't expected to be thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intcompress(byte[] src, int srcOff, int srcLen) Compress to a byte array.intcompress(long srcPtr, int srcOff, int srcLen) Compress to a byte array from a raw memory pointer.byte[]Target of the compress method.voiddecompress(byte[] src, int srcOff, int srcLen, byte[] dst, int dstOff, int dstLen) Decompress to a byte array.voiddecompress(byte[] src, int srcOff, int srcLen, long dstPtr, int dstOff, int dstLen) Decompress to a raw memory pointer.static PageCompressorlz4()Returns a new LZ4 compressor.static PageCompressorzlib()Returns a new ZLIB compressor (deflate).static PageCompressorzlib(int level) Returns a new ZLIB compressor (deflate).
-
Method Details
-
zlib
Returns a new ZLIB compressor (deflate). -
zlib
Returns a new ZLIB compressor (deflate).- Parameters:
level- compression level [0..9]
-
lz4
Returns a new LZ4 compressor. -
compress
Compress to a byte array.- Returns:
- the compressed size
- Throws:
IOException
-
compress
Compress to a byte array from a raw memory pointer.- 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, byte[] dst, int dstOff, int dstLen) throws IOException Decompress to a byte array.- Parameters:
dstLen- original size of uncompressed page- Throws:
IOException
-
decompress
void decompress(byte[] src, int srcOff, int srcLen, long dstPtr, int dstOff, int dstLen) throws IOException Decompress to a raw memory pointer.- Parameters:
dstLen- original size of uncompressed page- Throws:
IOException
-
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-