Class ZstdCompressor

java.lang.Object
com.yahoo.compress.ZstdCompressor

public class ZstdCompressor extends Object
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 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 (since getDecompressedLength(byte[], int, int) only includes the first frame) The decompress(byte[], int, int, byte[], int, int) overload will try to decompress all frame, 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)