Class ZstdDirectBufferCompressingStreamNoFinalizer

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

public class ZstdDirectBufferCompressingStreamNoFinalizer extends Object implements Closeable, Flushable
  • Field Details

    • target

      private ByteBuffer target
    • stream

      private final long stream
    • consumed

      private int consumed
    • produced

      private int produced
    • closed

      private boolean closed
    • initialized

      private boolean initialized
    • level

      private int level
    • dict

      private byte[] dict
    • fastDict

      private ZstdDictCompress fastDict
  • Constructor Details

    • ZstdDirectBufferCompressingStreamNoFinalizer

      public ZstdDirectBufferCompressingStreamNoFinalizer(ByteBuffer target, int level) throws IOException
      Throws:
      IOException
  • Method Details

    • flushBuffer

      protected ByteBuffer flushBuffer(ByteBuffer toFlush) throws IOException
      This method should flush the buffer and either return the same buffer (but cleared) or a new buffer that should be used from then on.
      Parameters:
      toFlush - buffer that has to be flushed (or most cases, you want to call ByteBuffer.flip() first)
      Returns:
      the new buffer to use, for most cases the same as the one passed in, after a call to ByteBuffer.clear().
      Throws:
      IOException
    • recommendedOutputBufferSize

      public static int recommendedOutputBufferSize()
    • recommendedCOutSize

      private static long recommendedCOutSize()
    • createCStream

      private static long createCStream()
    • freeCStream

      private static long freeCStream(long ctx)
    • initCStream

      private long initCStream(long ctx, int level)
    • initCStreamWithDict

      private long initCStreamWithDict(long ctx, byte[] dict, int dict_size, int level)
    • initCStreamWithFastDict

      private long initCStreamWithFastDict(long ctx, ZstdDictCompress dict)
    • compressDirectByteBuffer

      private long compressDirectByteBuffer(long ctx, ByteBuffer dst, int dstOffset, int dstSize, ByteBuffer src, int srcOffset, int srcSize)
    • flushStream

      private long flushStream(long ctx, ByteBuffer dst, int dstOffset, int dstSize)
    • endStream

      private long endStream(long ctx, ByteBuffer dst, int dstOffset, int dstSize)
    • setDict

      public ZstdDirectBufferCompressingStreamNoFinalizer setDict(byte[] dict)
    • setDict

    • compress

      public void compress(ByteBuffer source) throws IOException
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Specified by:
      flush in interface Flushable
      Throws:
      IOException
    • close

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