public class Bzip2Encoder extends MessageToByteEncoder<ByteBuf>
ChannelHandler.Sharable| Constructor and Description |
|---|
Bzip2Encoder()
创建具有最大(900,000字节)块大小的新bzip2编码器。
|
Bzip2Encoder(int blockSizeMultiplier)
用指定的
blockSizeMultiplier创建一个新的bzip2编码器。
|
| Modifier and Type | Method and Description |
|---|---|
ChannelFuture |
close()
关闭此 Bzip2Encoder并完成编码。
|
void |
close(ChannelHandlerContext ctx, ChannelPromise promise)
|
ChannelFuture |
close(ChannelPromise promise)
关闭此 Bzip2Encoder并完成编码。
|
protected void |
encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out)
将消息编码成 ByteBuf 。
|
void |
handlerAdded(ChannelHandlerContext ctx)
子类可以忽略这个方法。
|
boolean |
isClosed()
当且仅当已达到压缩流的结束时才返回
true 。
|
acceptOutboundMessage, allocateBuffer, isPreferDirect, writebind, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerRemovedpublic Bzip2Encoder()
public Bzip2Encoder(int blockSizeMultiplier)
blockSizeMultiplier创建一个新的bzip2编码器。
blockSizeMultiplier - Bzip2块大小为100,000字节的倍数(最小值为1 ,最大值为9 )。
较大的块大小需要更多的压缩和解压缩内存,但压缩比更高。
9通常是最好的使用价值。
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf 。
这个方法将被编码器处理的每个书面信息调用。
encode在课程
MessageToByteEncoder<ByteBuf>
ctx - 这MessageToByteEncoder所属的ChannelHandlerContext
in - 要编码的消息
out - 将写入编码消息的ByteBuf
java.lang.Exception - 发生错误时抛出
public boolean isClosed()
true 。
public ChannelFuture close()
Bzip2Encoder并完成编码。
一旦操作完成,返回的ChannelFuture将会收到通知。
public ChannelFuture close(ChannelPromise promise)
Bzip2Encoder并完成编码。
一旦操作完成,给定的ChannelFuture将会收到通知,并且还将返回。
public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
ChannelOutboundHandlerAdapter
ChannelOutboundInvoker.close(ChannelPromise)转发到ChannelPipeline中的下一个ChannelOutboundHandler 。
子类可以重写此方法来更改行为。
close接口
ChannelOutboundHandler
close
ChannelOutboundHandlerAdapter
ctx - 紧密操作的ChannelHandlerContext
promise - 在操作完成后通知ChannelPromise
java.lang.Exception - 如果发生错误则抛出
public void handlerAdded(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapter
handlerAdded接口
ChannelHandler
handlerAdded在课堂
ChannelHandlerAdapter
java.lang.Exception
Copyright © 2008–2018 The Netty Project. All rights reserved.