public class ZlibDecoder extends ZlibCodec implements IDecoder<byte[],ByteBuffer>, IEventDrivenCodec
ZlibCodec.Mode
Modifier and Type | Field and Description |
---|---|
protected Inflater |
inflater
The decompressor used by this class to decompress data.
|
Modifier | Constructor and Description |
---|---|
|
ZlibDecoder()
Creates a new zlib decoder with the default mode (
ZLIB ). |
|
ZlibDecoder(byte[] dictionary)
Creates a new zlib decoder with a preset dictionary for decompression and the
default mode (
ZLIB ). |
protected |
ZlibDecoder(byte[] dictionary,
ZlibCodec.Mode mode)
Creates a new zlib decoder with a preset dictionary for decompression and the
mode.
|
|
ZlibDecoder(ZlibCodec.Mode mode)
Creates a new zlib decoder with the specified mode.
|
Modifier and Type | Method and Description |
---|---|
void |
added(ISession session,
ICodecPipeline pipeline)
Does nothing.
|
void |
decode(ISession session,
byte[] data,
List<ByteBuffer> out)
Decompresses the input data.
|
void |
event(ISession session,
SessionEvent event)
Finishes the decompression when the associated session is ending
(
SessionEvent.ENDING ). |
protected int |
inflateBound(int len)
Returns upper bound on the decompressed size.
|
boolean |
isFinished()
Tells if the decompression has been finished.
|
protected boolean |
postFinish(ISession session,
ByteBuffer in)
Called right after the decompression has been finished.
|
protected void |
postInflate(ISession session,
byte[] data,
int off,
int len)
Called right after decompression of a portion of compressed data.
|
protected void |
preInflate(ISession session,
ByteBuffer in)
Called right before decompression of a portion of compressed data.
|
void |
removed(ISession session,
ICodecPipeline pipeline)
Does nothing.
|
getInboundType, getOutboundType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInboundType, getOutboundType
protected Inflater inflater
public ZlibDecoder()
ZLIB
).public ZlibDecoder(byte[] dictionary)
ZLIB
).dictionary
- the preset dictionary or null
if no preset
dictionary should be usedpublic ZlibDecoder(ZlibCodec.Mode mode)
mode
- the mode for the zlib decoderNullPointerException
- if the mode is nullprotected ZlibDecoder(byte[] dictionary, ZlibCodec.Mode mode)
dictionary
- the preset dictionary or null
if no preset
dictionary should be usedmode
- the mode for the zlib decoderprotected int inflateBound(int len)
len
- the length of the compressed data.protected void preInflate(ISession session, ByteBuffer in) throws Exception
session
- the session object the decoder is associated within
- the compressed input dataException
- if an error has occurredprotected void postInflate(ISession session, byte[] data, int off, int len) throws Exception
session
- the session object the decoder is associated withdata
- an array with decompressed dataoff
- the start offset in the array at which the data should
be readlen
- the number of bytes to readException
- if an error has occurredprotected boolean postFinish(ISession session, ByteBuffer in) throws Exception
session
- the session object the decoder is associated within
- the compressed input datatrue
if all bytes forming the footer has been already
consumedException
- if an error has occurredpublic boolean isFinished()
true
if the decompression has been finished.public void decode(ISession session, byte[] data, List<ByteBuffer> out) throws Exception
public void added(ISession session, ICodecPipeline pipeline)
added
in interface IEventDrivenCodec
session
- the session the pipeline is associated withpipeline
- the pipeline the codec has been added topublic void event(ISession session, SessionEvent event)
SessionEvent.ENDING
).event
in interface IEventDrivenCodec
session
- the session which state is changingevent
- the session eventpublic void removed(ISession session, ICodecPipeline pipeline)
removed
in interface IEventDrivenCodec
session
- the session the pipeline is associated withpipeline
- the pipeline the codec has been removed fromCopyright © 2017–2022 SNF4J.ORG. All rights reserved.