public class JdkZlibDecoder extends ZlibDecoder
ByteBuf
using the inflate algorithm.Modifier and Type | Class and Description |
---|---|
private static class |
JdkZlibDecoder.GzipState |
ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
private java.util.zip.CRC32 |
crc |
private boolean |
decideZlibOrNone |
private byte[] |
dictionary |
private static int |
FCOMMENT |
private static int |
FEXTRA |
private static int |
FHCRC |
private boolean |
finished |
private int |
flags |
private static int |
FNAME |
private static int |
FRESERVED |
private JdkZlibDecoder.GzipState |
gzipState |
private java.util.zip.Inflater |
inflater |
private int |
xlen |
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
Modifier | Constructor and Description |
---|---|
|
JdkZlibDecoder()
Creates a new instance with the default wrapper (
ZlibWrapper.ZLIB ). |
|
JdkZlibDecoder(byte[] dictionary)
Creates a new instance with the specified preset dictionary.
|
|
JdkZlibDecoder(ZlibWrapper wrapper)
Creates a new instance with the specified wrapper.
|
private |
JdkZlibDecoder(ZlibWrapper wrapper,
byte[] dictionary) |
Modifier and Type | Method and Description |
---|---|
protected void |
decode(ChannelHandlerContext ctx,
ByteBuf in,
java.util.List<java.lang.Object> out)
Decode the from one
ByteBuf to an other. |
protected void |
handlerRemoved0(ChannelHandlerContext ctx)
Gets called after the
ByteToMessageDecoder was removed from the actual context and it doesn't handle
events anymore. |
boolean |
isClosed()
Returns
true if and only if the end of the compressed stream
has been reached. |
private static boolean |
looksLikeZlib(short cmf_flg) |
private boolean |
readGZIPFooter(ByteBuf buf) |
private boolean |
readGZIPHeader(ByteBuf in) |
private void |
verifyCrc(ByteBuf in) |
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
private static final int FHCRC
private static final int FEXTRA
private static final int FNAME
private static final int FCOMMENT
private static final int FRESERVED
private java.util.zip.Inflater inflater
private final byte[] dictionary
private final java.util.zip.CRC32 crc
private JdkZlibDecoder.GzipState gzipState
private int flags
private int xlen
private volatile boolean finished
private boolean decideZlibOrNone
public JdkZlibDecoder()
ZlibWrapper.ZLIB
).public JdkZlibDecoder(byte[] dictionary)
ZlibWrapper.ZLIB
because it is the only format that
supports the preset dictionary.public JdkZlibDecoder(ZlibWrapper wrapper)
ZlibWrapper.GZIP
, ZlibWrapper.ZLIB
and ZlibWrapper.NONE
are
supported atm.private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary)
public boolean isClosed()
ZlibDecoder
true
if and only if the end of the compressed stream
has been reached.isClosed
in class ZlibDecoder
protected void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
ByteToMessageDecoder
ByteBuf
to an other. This method will be called till either the input
ByteBuf
has nothing to read when return from this method or till nothing was read from the input
ByteBuf
.decode
in class ByteToMessageDecoder
ctx
- the ChannelHandlerContext
which this ByteToMessageDecoder
belongs toin
- the ByteBuf
from which to read dataout
- the List
to which decoded messages should be addedjava.lang.Exception
- is thrown if an error accourprotected void handlerRemoved0(ChannelHandlerContext ctx) throws java.lang.Exception
ByteToMessageDecoder
ByteToMessageDecoder
was removed from the actual context and it doesn't handle
events anymore.handlerRemoved0
in class ByteToMessageDecoder
java.lang.Exception
private boolean readGZIPHeader(ByteBuf in)
private boolean readGZIPFooter(ByteBuf buf)
private void verifyCrc(ByteBuf in)
private static boolean looksLikeZlib(short cmf_flg)