Top Description Inners Fields Constructors Methods
io.netty.handler.codec.compression

public Class LzfDecoder

extends ByteToMessageDecoder
Class Inheritance
Imports
com.ning.compress.BufferRecycler, com.ning.compress.lzf.ChunkDecoder, .LZFChunk, com.ning.compress.lzf.util.ChunkDecoderFactory, io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.ByteToMessageDecoder, java.util.List

Uncompresses a ByteBuf encoded with the LZF format. See original LZF package and LZF format for full description.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
LzfDecoder.State

Current state of decompression.

Field Summary

Modifier and TypeField and Description
private int
chunkLength

Length of current received chunk of data.

private LzfDecoder.State
private ChunkDecoder
decoder

Underlying decoder in use.

private boolean
isCompressed

Indicates is this chunk compressed or not.

private static final short
MAGIC_NUMBER

Magic number of LZF chunk.

private int
originalLength

Original length of current received chunk of data.

private BufferRecycler
recycler

Object that handles details of buffer recycling.

Inherited from io.netty.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
public
LzfDecoder()

Creates a new LZF decoder with the most optimal available methods for underlying data access.

public
LzfDecoder(boolean
If true decoder will use ChunkDecoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs. Otherwise decoder will try to use highly optimized ChunkDecoder implementation that uses Sun JDK's sun.misc.Unsafe class (which may be included by other JDK's as well).
safeInstance
)

Creates a new LZF decoder with specified decoding instance.

Method Summary

Modifier and TypeMethod and Description
protected void
decode(ChannelHandlerContext ctx, ByteBuf
the ByteBuf from which to read data
in
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other.
Inherited from io.netty.handler.codec.ByteToMessageDecoder:
actualReadableBytescallDecodechannelInactivechannelReadchannelReadCompletedecodeLastdiscardSomeReadByteshandlerRemovedhandlerRemoved0internalBufferisSingleDecodesetCumulatorsetDiscardAfterReadssetSingleDecodeuserEventTriggered

Field Detail

chunkLengthback to summary
private int chunkLength

Length of current received chunk of data.

currentStateback to summary
private LzfDecoder.State currentState
decoderback to summary
private ChunkDecoder decoder

Underlying decoder in use.

isCompressedback to summary
private boolean isCompressed

Indicates is this chunk compressed or not.

MAGIC_NUMBERback to summary
private static final short MAGIC_NUMBER

Magic number of LZF chunk.

originalLengthback to summary
private int originalLength

Original length of current received chunk of data. It is equal to chunkLength for non compressed chunks.

recyclerback to summary
private BufferRecycler recycler

Object that handles details of buffer recycling.

Constructor Detail

LzfDecoderback to summary
public LzfDecoder()

Creates a new LZF decoder with the most optimal available methods for underlying data access. It will "unsafe" instance if one can be used on current JVM. It should be safe to call this constructor as implementations are dynamically loaded; however, on some non-standard platforms it may be necessary to use LzfDecoder(boolean) with true param.

LzfDecoderback to summary
public LzfDecoder(boolean safeInstance)

Creates a new LZF decoder with specified decoding instance.

Parameters
safeInstance:boolean

If true decoder will use ChunkDecoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs. Otherwise decoder will try to use highly optimized ChunkDecoder implementation that uses Sun JDK's sun.misc.Unsafe class (which may be included by other JDK's as well).

Method Detail

decodeback to summary
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one 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.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:ByteBuf

the ByteBuf from which to read data

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
io.netty.handler.codec.compression back to summary

private final Enum LzfDecoder.State

extends Enum<LzfDecoder.State>
Class Inheritance

Current state of decompression.

Field Summary

Modifier and TypeField and Description
public static final LzfDecoder.State
public static final LzfDecoder.State
public static final LzfDecoder.State
public static final LzfDecoder.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static LzfDecoder.State
public static LzfDecoder.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CORRUPTEDback to summary
public static final LzfDecoder.State CORRUPTED
DECOMPRESS_DATAback to summary
public static final LzfDecoder.State DECOMPRESS_DATA
INIT_BLOCKback to summary
public static final LzfDecoder.State INIT_BLOCK
INIT_ORIGINAL_LENGTHback to summary
public static final LzfDecoder.State INIT_ORIGINAL_LENGTH

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static LzfDecoder.State valueOf(String name)
valuesback to summary
public static LzfDecoder.State[] values()