Class ZstdCompressor

  • All Implemented Interfaces:
    ICompressor

    public class ZstdCompressor
    extends java.lang.Object
    implements ICompressor
    ZSTD Compressor
    • Field Detail

      • FAST_COMPRESSION_LEVEL

        public static final int FAST_COMPRESSION_LEVEL
      • BEST_COMPRESSION_LEVEL

        public static final int BEST_COMPRESSION_LEVEL
      • DEFAULT_COMPRESSION_LEVEL

        public static final int DEFAULT_COMPRESSION_LEVEL
        See Also:
        Constant Field Values
      • COMPRESSION_LEVEL_OPTION_NAME

        public static final java.lang.String COMPRESSION_LEVEL_OPTION_NAME
        See Also:
        Constant Field Values
    • Method Detail

      • create

        public static ZstdCompressor create​(java.util.Map<java.lang.String,​java.lang.String> options)
        Create a Zstd compressor with the given options
        Parameters:
        options -
        Returns:
      • getOrCreate

        public static ZstdCompressor getOrCreate​(int level)
        Get a cached instance or return a new one
        Parameters:
        level -
        Returns:
      • initialCompressedBufferLength

        public int initialCompressedBufferLength​(int chunkLength)
        Get initial compressed buffer length
        Specified by:
        initialCompressedBufferLength in interface ICompressor
        Parameters:
        chunkLength -
        Returns:
      • uncompress

        public int uncompress​(byte[] input,
                              int inputOffset,
                              int inputLength,
                              byte[] output,
                              int outputOffset)
                       throws java.io.IOException
        Decompress data using arrays
        Specified by:
        uncompress in interface ICompressor
        Parameters:
        input -
        inputOffset -
        inputLength -
        output -
        outputOffset -
        Returns:
        Throws:
        java.io.IOException
      • uncompress

        public void uncompress​(java.nio.ByteBuffer input,
                               java.nio.ByteBuffer output)
                        throws java.io.IOException
        Decompress data via ByteBuffers
        Specified by:
        uncompress in interface ICompressor
        Parameters:
        input -
        output -
        Throws:
        java.io.IOException
      • compress

        public void compress​(java.nio.ByteBuffer input,
                             java.nio.ByteBuffer output)
                      throws java.io.IOException
        Compress using ByteBuffers
        Specified by:
        compress in interface ICompressor
        Parameters:
        input -
        output -
        Throws:
        java.io.IOException
      • supports

        public boolean supports​(BufferType bufferType)
        Check whether the given BufferType is supported
        Specified by:
        supports in interface ICompressor
        Parameters:
        bufferType -
        Returns:
      • supportedOptions

        public java.util.Set<java.lang.String> supportedOptions()
        Lists the supported options by this compressor
        Specified by:
        supportedOptions in interface ICompressor
        Returns:
      • getCompressionLevel

        public int getCompressionLevel()
      • recommendedUses

        public java.util.Set<ICompressor.Uses> recommendedUses()
        Description copied from interface: ICompressor
        Hints to Cassandra which uses this compressor is recommended for. For example a compression algorithm which gets good compression ratio may trade off too much compression speed to be useful in certain compression heavy use cases such as flushes or mutation hints. Note that Cassandra may ignore these recommendations, it is not a strict contract.
        Specified by:
        recommendedUses in interface ICompressor