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 void
close()
final boolean
isOpen()
int
write
(ByteBuffer src)
-
Constructor Details
-
ZstdCompressWritableChunkChannel
Constructs a new channel.- Parameters:
chunkSupplier
- the chunk supplier, must provide direct byte buffers, cannot benull
level
- the Zstd compression level, eligible values are from 1 to 22 (inclusive)- Throws:
IOException
- if an IO error occurs
-
-
Method Details
-
write
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
isOpen
public final boolean isOpen() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-