public class JdkZlibEncoder extends OneToOneStrictEncoder implements LifeCycleAwareChannelHandler
ChannelBuffer using the deflate algorithm.ChannelHandler.Sharable| 构造器和说明 |
|---|
JdkZlibEncoder()
Creates a new zlib encoder with the default compression level (
6)
and the default wrapper (ZlibWrapper.ZLIB). |
JdkZlibEncoder(byte[] dictionary)
Creates a new zlib encoder with the default compression level (
6)
and the specified preset dictionary. |
JdkZlibEncoder(int compressionLevel)
Creates a new zlib encoder with the specified
compressionLevel
and the default wrapper (ZlibWrapper.ZLIB). |
JdkZlibEncoder(int compressionLevel,
byte[] dictionary)
Creates a new zlib encoder with the specified
compressionLevel
and the specified preset dictionary. |
JdkZlibEncoder(ZlibWrapper wrapper)
Creates a new zlib encoder with the default compression level (
6)
and the specified wrapper. |
JdkZlibEncoder(ZlibWrapper wrapper,
int compressionLevel)
Creates a new zlib encoder with the specified
compressionLevel
and the specified wrapper. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterAdd(ChannelHandlerContext ctx) |
void |
afterRemove(ChannelHandlerContext ctx) |
void |
beforeAdd(ChannelHandlerContext ctx) |
void |
beforeRemove(ChannelHandlerContext ctx) |
ChannelFuture |
close() |
protected java.lang.Object |
encode(ChannelHandlerContext ctx,
Channel channel,
java.lang.Object msg)
Transforms the specified message into another message and return the
transformed message.
|
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent evt)
Handles the specified downstream event.
|
boolean |
isClosed() |
doEncodepublic JdkZlibEncoder()
6)
and the default wrapper (ZlibWrapper.ZLIB).CompressionException - if failed to initialize zlibpublic JdkZlibEncoder(int compressionLevel)
compressionLevel
and the default wrapper (ZlibWrapper.ZLIB).compressionLevel - 1 yields the fastest compression and 9 yields the
best compression. 0 means no compression. The default
compression level is 6.CompressionException - if failed to initialize zlibpublic JdkZlibEncoder(ZlibWrapper wrapper)
6)
and the specified wrapper.CompressionException - if failed to initialize zlibpublic JdkZlibEncoder(ZlibWrapper wrapper, int compressionLevel)
compressionLevel
and the specified wrapper.compressionLevel - 1 yields the fastest compression and 9 yields the
best compression. 0 means no compression. The default
compression level is 6.CompressionException - if failed to initialize zlibpublic JdkZlibEncoder(byte[] dictionary)
6)
and the specified preset dictionary. The wrapper is always
ZlibWrapper.ZLIB because it is the only format that supports
the preset dictionary.dictionary - the preset dictionaryCompressionException - if failed to initialize zlibpublic JdkZlibEncoder(int compressionLevel,
byte[] dictionary)
compressionLevel
and the specified preset dictionary. The wrapper is always
ZlibWrapper.ZLIB because it is the only format that supports
the preset dictionary.compressionLevel - 1 yields the fastest compression and 9 yields the
best compression. 0 means no compression. The default
compression level is 6.dictionary - the preset dictionaryCompressionException - if failed to initialize zlibpublic ChannelFuture close()
public boolean isClosed()
protected java.lang.Object encode(ChannelHandlerContext ctx, Channel channel, java.lang.Object msg) throws java.lang.Exception
OneToOneEncodernull, unlike
you can in OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object);
you must return something, at least ChannelBuffers.EMPTY_BUFFER.encode 在类中 OneToOneEncoderjava.lang.Exceptionpublic void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
ChannelDownstreamHandlerhandleDownstream 在接口中 ChannelDownstreamHandlerhandleDownstream 在类中 OneToOneEncoderctx - the context object for this handlerevt - the downstream event to process or interceptjava.lang.Exceptionpublic void beforeAdd(ChannelHandlerContext ctx) throws java.lang.Exception
beforeAdd 在接口中 LifeCycleAwareChannelHandlerjava.lang.Exceptionpublic void afterAdd(ChannelHandlerContext ctx) throws java.lang.Exception
afterAdd 在接口中 LifeCycleAwareChannelHandlerjava.lang.Exceptionpublic void beforeRemove(ChannelHandlerContext ctx) throws java.lang.Exception
beforeRemove 在接口中 LifeCycleAwareChannelHandlerjava.lang.Exceptionpublic void afterRemove(ChannelHandlerContext ctx) throws java.lang.Exception
afterRemove 在接口中 LifeCycleAwareChannelHandlerjava.lang.Exception