public class Bzip2Encoder extends MessageToByteEncoder<ByteBuf>
ChannelHandler.Sharable
构造器和说明 |
---|
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 . |
限定符和类型 | 方法和说明 |
---|---|
ChannelFuture |
close()
Close this
Bzip2Encoder and so finish the encoding. |
void |
close(ChannelHandlerContext ctx,
ChannelPromise promise)
Calls
ChannelOutboundInvoker.close(ChannelPromise) to forward
to the next ChannelOutboundHandler 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, isPreferDirect, write
bind, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerRemoved
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(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
在类中 MessageToByteEncoder<ByteBuf>
ctx
- the ChannelHandlerContext
which this MessageToByteEncoder
belongs toin
- the message to encodeout
- the ByteBuf
into which the encoded message will be writtenjava.lang.Exception
- is thrown if an error occurspublic 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 java.lang.Exception
ChannelOutboundHandlerAdapter
ChannelOutboundInvoker.close(ChannelPromise)
to forward
to the next ChannelOutboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.close
在接口中 ChannelOutboundHandler
close
在类中 ChannelOutboundHandlerAdapter
ctx
- the ChannelHandlerContext
for which the close operation is madepromise
- the ChannelPromise
to notify once the operation completesjava.lang.Exception
- thrown if an error occurspublic void handlerAdded(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapter
handlerAdded
在接口中 ChannelHandler
handlerAdded
在类中 ChannelHandlerAdapter
java.lang.Exception