Class ZstdDecompressCtx

  • All Implemented Interfaces:
    java.io.Closeable

    public class ZstdDecompressCtx
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ZstdDecompressCtx()
      Create a context for faster compress operations One such context is required for each thread - put this in a ThreadLocal.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      int decompress​(byte[] dst, byte[] src)  
      byte[] decompress​(byte[] src, int originalSize)  
      java.nio.ByteBuffer decompress​(java.nio.ByteBuffer srcBuf, int originalSize)  
      int decompress​(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)
      Decompresses buffer 'srcBuff' into buffer 'dstBuff' using this ZstdDecompressCtx.
      int decompressByteArray​(byte[] dstBuff, int dstOffset, int dstSize, byte[] srcBuff, int srcOffset, int srcSize)
      Decompresses byte array 'srcBuff' into byte array 'dstBuff' using this ZstdDecompressCtx.
      int decompressDirectByteBuffer​(java.nio.ByteBuffer dstBuff, int dstOffset, int dstSize, java.nio.ByteBuffer srcBuff, int srcOffset, int srcSize)
      Decompresses buffer 'srcBuff' into buffer 'dstBuff' using this ZstdDecompressCtx.
      ZstdDecompressCtx loadDict​(byte[] dict)
      Load decompression dictionary.
      ZstdDecompressCtx loadDict​(ZstdDictDecompress dict)
      Load decompression dictionary
      • Methods inherited from class java.lang.Object

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

      • ZstdDecompressCtx

        public ZstdDecompressCtx()
        Create a context for faster compress operations One such context is required for each thread - put this in a ThreadLocal.
    • Method Detail

      • loadDict

        public ZstdDecompressCtx loadDict​(ZstdDictDecompress dict)
        Load decompression dictionary
        Parameters:
        dict - the dictionary or `null` to remove loaded dictionary
      • loadDict

        public ZstdDecompressCtx loadDict​(byte[] dict)
        Load decompression dictionary.
        Parameters:
        dict - the dictionary or `null` to remove loaded dictionary
      • decompressDirectByteBuffer

        public int decompressDirectByteBuffer​(java.nio.ByteBuffer dstBuff,
                                              int dstOffset,
                                              int dstSize,
                                              java.nio.ByteBuffer srcBuff,
                                              int srcOffset,
                                              int srcSize)
        Decompresses buffer 'srcBuff' into buffer 'dstBuff' using this ZstdDecompressCtx. Destination buffer should be sized to be larger of equal to the originalSize. This is a low-level function that does not take into account or affect the `limit` or `position` of source or destination buffers.
        Parameters:
        dstBuff - the destination buffer - must be direct
        dstOffset - the start offset of 'dstBuff'
        dstSize - the size of 'dstBuff'
        srcBuff - the source buffer - must be direct
        srcOffset - the start offset of 'srcBuff'
        srcSize - the size of 'srcBuff'
        Returns:
        the number of bytes decompressed into destination buffer (originalSize)
      • decompressByteArray

        public int decompressByteArray​(byte[] dstBuff,
                                       int dstOffset,
                                       int dstSize,
                                       byte[] srcBuff,
                                       int srcOffset,
                                       int srcSize)
        Decompresses byte array 'srcBuff' into byte array 'dstBuff' using this ZstdDecompressCtx. Destination buffer should be sized to be larger of equal to the originalSize.
        Parameters:
        dstBuff - the destination buffer
        dstOffset - the start offset of 'dstBuff'
        dstSize - the size of 'dstBuff'
        srcBuff - the source buffer
        srcOffset - the start offset of 'srcBuff'
        srcSize - the size of 'srcBuff'
        Returns:
        the number of bytes decompressed into destination buffer (originalSize)
      • decompress

        public int decompress​(java.nio.ByteBuffer dstBuf,
                              java.nio.ByteBuffer srcBuf)
                       throws ZstdException
        Decompresses buffer 'srcBuff' into buffer 'dstBuff' using this ZstdDecompressCtx. Destination buffer should be sized to be larger of equal to the originalSize.
        Parameters:
        dstBuf - the destination buffer - must be direct. It is assumed that the `position()` of this buffer marks the offset at which the decompressed data are to be written, and that the `limit()` of this buffer is the maximum decompressed data size to allow.

        When this method returns successfully, its `position()` will be set to its current `position()` plus the decompressed size of the data.

        srcBuf - the source buffer - must be direct. It is assumed that the `position()` of this buffer marks the beginning of the compressed data to be decompressed, and that the `limit()` of this buffer marks its end.

        When this method returns successfully, its `position()` will be set to the initial `limit()`.

        Returns:
        the size of the decompressed data.
        Throws:
        ZstdException
      • decompress

        public java.nio.ByteBuffer decompress​(java.nio.ByteBuffer srcBuf,
                                              int originalSize)
                                       throws ZstdException
        Throws:
        ZstdException
      • decompress

        public int decompress​(byte[] dst,
                              byte[] src)
      • close

        public void close()
        Specified by:
        close in interface java.io.Closeable