Class ZstdDictCompress

java.lang.Object
com.github.luben.zstd.ZstdDictCompress
All Implemented Interfaces:
Closeable, AutoCloseable

public class ZstdDictCompress extends Object
  • Constructor Details

    • ZstdDictCompress

      public ZstdDictCompress(byte[] dict, int level)
      Convenience constructor to create a new dictionary for use with fast compress
      Parameters:
      dict - buffer containing dictionary to load/parse with exact length
      level - compression level
    • ZstdDictCompress

      public ZstdDictCompress(byte[] dict, int offset, int length, int level)
      Create a new dictionary for use with fast compress
      Parameters:
      dict - buffer containing dictionary
      offset - the offset into the buffer to read from
      length - number of bytes to use from the buffer
      level - compression level
    • ZstdDictCompress

      public ZstdDictCompress(ByteBuffer dict, int level)
      Create a new dictionary for use with fast compress. The provided bytebuffer is available for reuse when the method returns.
      Parameters:
      dict - Direct ByteBuffer containing dictionary using position and limit to define range in buffer.
      level - compression level
    • ZstdDictCompress

      public ZstdDictCompress(ByteBuffer dict, int level, boolean byReference)
      Create a new dictionary for use with fast compress. If byReference is true, then the native code does not copy the data but keeps a reference to the byte buffer, which must then not be modified before this context has been closed.
      Parameters:
      dict - Direct ByteBuffer containing dictionary using position and limit to define range in buffer.
      level - compression level
      byReference - tell the native part to use the byte buffer directly and not copy the data when true.
  • Method Details

    • getByReferenceBuffer

      public ByteBuffer getByReferenceBuffer()
      Get the byte buffer that backs this dict, if any, or null if not backed by a byte buffer.
    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable