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

public Class SnappyFrameDecoder

extends ByteToMessageDecoder
Class Inheritance
Known Direct Subclasses
io.netty.handler.codec.compression.SnappyFramedDecoder
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.ByteToMessageDecoder, java.util.List

Uncompresses a ByteBuf encoded with the Snappy framing format. See Snappy framing format. Note that by default, validation of the checksum header in each chunk is DISABLED for performance improvements. If performance is less of an issue, or if you would prefer the safety that checksum validation brings, please use the SnappyFrameDecoder(boolean) constructor with the argument set to true.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private boolean
private static final int
private static final int
private static final int
private int
private final Snappy
private static final int
private boolean
private final boolean
Inherited from io.netty.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
public
SnappyFrameDecoder()

Creates a new snappy-framed decoder with validation of checksums turned OFF.

public
SnappyFrameDecoder(boolean
If true, the checksum field will be validated against the actual uncompressed data, and if the checksums do not match, a suitable DecompressionException will be thrown
validateChecksums
)

Creates a new snappy-framed decoder with validation of checksums as specified.

Method Summary

Modifier and TypeMethod and Description
private static void
checkByte(byte actual, byte expect)

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.
private static SnappyFrameDecoder.ChunkType

Returns:

The appropriate ChunkType, defaulting to ChunkType#RESERVED_UNSKIPPABLE
mapChunkType
(byte
The tag byte extracted from the stream
type
)

Decodes the chunk type from the type tag byte.

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

Field Detail

corruptedback to summary
private boolean corrupted
MAX_COMPRESSED_CHUNK_SIZEback to summary
private static final int MAX_COMPRESSED_CHUNK_SIZE
MAX_DECOMPRESSED_DATA_SIZEback to summary
private static final int MAX_DECOMPRESSED_DATA_SIZE
MAX_UNCOMPRESSED_DATA_SIZEback to summary
private static final int MAX_UNCOMPRESSED_DATA_SIZE
numBytesToSkipback to summary
private int numBytesToSkip
snappyback to summary
private final Snappy snappy
SNAPPY_IDENTIFIER_LENback to summary
private static final int SNAPPY_IDENTIFIER_LEN
startedback to summary
private boolean started
validateChecksumsback to summary
private final boolean validateChecksums

Constructor Detail

SnappyFrameDecoderback to summary
public SnappyFrameDecoder()

Creates a new snappy-framed decoder with validation of checksums turned OFF. To turn checksum validation on, please use the alternate SnappyFrameDecoder(boolean) constructor.

SnappyFrameDecoderback to summary
public SnappyFrameDecoder(boolean validateChecksums)

Creates a new snappy-framed decoder with validation of checksums as specified.

Parameters
validateChecksums:boolean

If true, the checksum field will be validated against the actual uncompressed data, and if the checksums do not match, a suitable DecompressionException will be thrown

Method Detail

checkByteback to summary
private static void checkByte(byte actual, byte expect)
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
mapChunkTypeback to summary
private static SnappyFrameDecoder.ChunkType mapChunkType(byte type)

Decodes the chunk type from the type tag byte.

Parameters
type:byte

The tag byte extracted from the stream

Returns:SnappyFrameDecoder.ChunkType

The appropriate ChunkType, defaulting to ChunkType#RESERVED_UNSKIPPABLE

io.netty.handler.codec.compression back to summary

private final Enum SnappyFrameDecoder.ChunkType

extends Enum<SnappyFrameDecoder.ChunkType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final SnappyFrameDecoder.ChunkType
public static final SnappyFrameDecoder.ChunkType
public static final SnappyFrameDecoder.ChunkType
public static final SnappyFrameDecoder.ChunkType
public static final SnappyFrameDecoder.ChunkType

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

COMPRESSED_DATAback to summary
public static final SnappyFrameDecoder.ChunkType COMPRESSED_DATA
RESERVED_SKIPPABLEback to summary
public static final SnappyFrameDecoder.ChunkType RESERVED_SKIPPABLE
RESERVED_UNSKIPPABLEback to summary
public static final SnappyFrameDecoder.ChunkType RESERVED_UNSKIPPABLE
STREAM_IDENTIFIERback to summary
public static final SnappyFrameDecoder.ChunkType STREAM_IDENTIFIER
UNCOMPRESSED_DATAback to summary
public static final SnappyFrameDecoder.ChunkType UNCOMPRESSED_DATA

Constructor Detail

ChunkTypeback to summary
private ChunkType()

Method Detail

valueOfback to summary
public static SnappyFrameDecoder.ChunkType valueOf(String name)
valuesback to summary
public static SnappyFrameDecoder.ChunkType[] values()