Package com.yahoo.compress
Class ZstdCompressor
java.lang.Object
com.yahoo.compress.ZstdCompressor
Frame based Zstd compressor (https://github.com/facebook/zstd)
Implemented based on https://github.com/airlift/aircompressor - a pure Java implementation (no JNI).
- Author:
- bjorncs
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
compress
(byte[] input, int inputOffset, int inputLength) int
compress
(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) byte[]
decompress
(byte[] input, int inputOffset, int inputLength) Note: Implementation assumes single frame (sincegetDecompressedLength(byte[], int, int)
only includes the first frame) Thedecompress(byte[], int, int, byte[], int, int)
overload will try to decompress all frames, causing the output buffer to overflow.int
decompress
(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) static int
getDecompressedLength
(byte[] input, int inputOffset, int inputLength) static int
getMaxCompressedLength
(int uncompressedLength)
-
Constructor Details
-
ZstdCompressor
public ZstdCompressor()
-
-
Method Details
-
compress
public byte[] compress(byte[] input, int inputOffset, int inputLength) -
compress
public int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) -
decompress
public byte[] decompress(byte[] input, int inputOffset, int inputLength) Note: Implementation assumes single frame (sincegetDecompressedLength(byte[], int, int)
only includes the first frame) Thedecompress(byte[], int, int, byte[], int, int)
overload will try to decompress all frames, causing the output buffer to overflow. -
decompress
public int decompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) -
getMaxCompressedLength
public static int getMaxCompressedLength(int uncompressedLength) -
getDecompressedLength
public static int getDecompressedLength(byte[] input, int inputOffset, int inputLength)
-