Class ZstdCompressor


  • public class ZstdCompressor
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      ZstdCompressor()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] 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 (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.
      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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZstdCompressor

        public ZstdCompressor()
    • Method Detail

      • 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 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)