Class ZstdCompressWritableChunkChannel
java.lang.Object
com.e1c.g5.v8.internal.fastzip.chunk.ZstdCompressWritableChunkChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,WritableByteChannel
A channel which compresses data with Zstandard algorithm and writes it to a sequence of chunks provided
by
IChunkSupplier.
Due to limitations of zstd-jni the destination byte buffers provided by the chunk supplier
must be direct. As any respectful channel's write, write(ByteBuffer) of this channel accepts indirect
byte buffers as well as direct ones, but a slight performance penalty is expected for indirect byte buffers
because of additional coping.
-
Constructor Summary
ConstructorsConstructorDescriptionZstdCompressWritableChunkChannel(IChunkSupplier chunkSupplier, int level) Constructs a new channel. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()final booleanisOpen()intwrite(ByteBuffer src)
-
Constructor Details
-
ZstdCompressWritableChunkChannel
Constructs a new channel.- Parameters:
chunkSupplier- the chunk supplier, must provide direct byte buffers, cannot benulllevel- the Zstd compression level, eligible values are from 1 to 22 (inclusive)- Throws:
IOException- if an IO error occurs
-
-
Method Details
-
write
- Specified by:
writein interfaceWritableByteChannel- Throws:
IOException
-
isOpen
public final boolean isOpen() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-