Package com.github.luben.zstd
Class ZstdDirectBufferCompressingStream
- java.lang.Object
-
- com.github.luben.zstd.ZstdDirectBufferCompressingStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class ZstdDirectBufferCompressingStream extends java.lang.Object implements java.io.Closeable, java.io.Flushable
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
finalize
(package private) ZstdDirectBufferCompressingStreamNoFinalizer
inner
-
Constructor Summary
Constructors Constructor Description ZstdDirectBufferCompressingStream(java.nio.ByteBuffer target, int level)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
compress(java.nio.ByteBuffer source)
protected void
finalize()
void
flush()
protected java.nio.ByteBuffer
flushBuffer(java.nio.ByteBuffer toFlush)
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.static int
recommendedOutputBufferSize()
ZstdDirectBufferCompressingStream
setDict(byte[] dict)
ZstdDirectBufferCompressingStream
setDict(ZstdDictCompress dict)
void
setFinalize(boolean finalize)
Enable or disable class finalizers If finalizers are disabled the responsibility fir calling the `close` method is on the consumer.
-
-
-
Field Detail
-
inner
ZstdDirectBufferCompressingStreamNoFinalizer inner
-
finalize
private boolean finalize
-
-
Method Detail
-
flushBuffer
protected java.nio.ByteBuffer flushBuffer(java.nio.ByteBuffer toFlush) throws java.io.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 callByteBuffer.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:
java.io.IOException
-
recommendedOutputBufferSize
public static int recommendedOutputBufferSize()
-
setDict
public ZstdDirectBufferCompressingStream setDict(byte[] dict) throws java.io.IOException
- Throws:
java.io.IOException
-
setDict
public ZstdDirectBufferCompressingStream setDict(ZstdDictCompress dict) throws java.io.IOException
- Throws:
java.io.IOException
-
setFinalize
public void setFinalize(boolean finalize)
Enable or disable class finalizers If finalizers are disabled the responsibility fir calling the `close` method is on the consumer.- Parameters:
finalize
- default `true` - finalizers are enabled
-
compress
public void compress(java.nio.ByteBuffer source) throws java.io.IOException
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-