public class Bzip2Encoder extends MessageToByteEncoder<ByteBuf>
ChannelHandler.Sharable, ChannelHandler.Skip| 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 |
|---|---|
ChannelFuture |
close()
Close this
Bzip2Encoder and so finish the encoding. |
void |
close(ChannelHandlerContext ctx,
ChannelPromise promise)
Calls
ChannelHandlerContext.close(ChannelPromise) to forward
to the next ChannelHandler in the ChannelPipeline. |
ChannelFuture |
close(ChannelPromise promise)
Close this
Bzip2Encoder and so finish the encoding. |
protected void |
encode(ChannelHandlerContext ctx,
ByteBuf in,
ByteBuf out)
Encode a message into a
ByteBuf. |
void |
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
boolean |
isClosed()
Returns
true if and only if the end of the compressed stream has been reached. |
acceptOutboundMessage, allocateBuffer, writebind, channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, connect, deregister, disconnect, exceptionCaught, flush, handlerRemoved, isSharable, read, userEventTriggeredpublic 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(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception
MessageToByteEncoderByteBuf. This method will be called for each written message that can be handled
by this encoder.encode in class MessageToByteEncoder<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 accourpublic boolean isClosed()
true if and only if the end of the compressed stream has been reached.public ChannelFuture close()
Bzip2Encoder and so finish the encoding.
The returned ChannelFuture will be notified once the operation completes.public ChannelFuture close(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(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
ChannelHandlerAdapterChannelHandlerContext.close(ChannelPromise) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.close in interface ChannelHandlerclose in class ChannelHandlerAdapterctx - the ChannelHandlerContext for which the close operation is madepromise - the ChannelPromise to notify once the operation completesException - thrown if an error accourpublic void handlerAdded(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterhandlerAdded in interface ChannelHandlerhandlerAdded in class ChannelHandlerAdapterExceptionCopyright © 2008–2015 The Netty Project. All rights reserved.