public class Bzip2Encoder extends MessageToByteEncoder<io.netty.buffer.ByteBuf>
ByteBuf
using the Bzip2 algorithm.
See Bzip2.Constructor and Description |
---|
Bzip2Encoder()
Creates a new bzip2 encoder with the maximum (900,000 byte) block size.
|
Bzip2Encoder(int blockSizeMultiplier)
Creates a new bzip2 encoder with the specified
blockSizeMultiplier . |
Modifier and Type | Method and Description |
---|---|
io.netty.channel.ChannelFuture |
close()
Close this
Bzip2Encoder and so finish the encoding. |
void |
close(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise) |
io.netty.channel.ChannelFuture |
close(io.netty.channel.ChannelPromise promise)
Close this
Bzip2Encoder and so finish the encoding. |
protected void |
encode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
io.netty.buffer.ByteBuf out)
Encode a message into a
ByteBuf . |
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx) |
boolean |
isClosed()
Returns
true if and only if the end of the compressed stream has been reached. |
acceptOutboundMessage, allocateBuffer, isPreferDirect, write
bind, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerRemoved, isSharable
public Bzip2Encoder()
public Bzip2Encoder(int blockSizeMultiplier)
blockSizeMultiplier
.blockSizeMultiplier
- The Bzip2 block size as a multiple of 100,000 bytes (minimum 1
, maximum 9
).
Larger block sizes require more memory for both compression and decompression,
but give better compression ratios. 9
will usually be the best value to use.protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, io.netty.buffer.ByteBuf out) throws Exception
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
in class MessageToByteEncoder<io.netty.buffer.ByteBuf>
ctx
- the ChannelHandlerContext
which this MessageToByteEncoder
belongs toin
- the message to encodeout
- the ByteBuf
into which the encoded message will be writtenException
- is thrown if an error occurspublic boolean isClosed()
true
if and only if the end of the compressed stream has been reached.public io.netty.channel.ChannelFuture close()
Bzip2Encoder
and so finish the encoding.
The returned ChannelFuture
will be notified once the operation completes.public io.netty.channel.ChannelFuture close(io.netty.channel.ChannelPromise promise)
Bzip2Encoder
and so finish the encoding.
The given ChannelFuture
will be notified once the operation
completes and will also be returned.public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) throws Exception
close
in interface io.netty.channel.ChannelOutboundHandler
close
in class io.netty.channel.ChannelOutboundHandlerAdapter
Exception
Copyright © 2008–2019 The Netty Project. All rights reserved.