public class ProtobufVarint32FrameDecoder extends FrameDecoder
ChannelBuffers dynamically by the
value of the Google Protocol Buffers
Base
128 Varints integer length field in the message. For example:
BEFORE DECODE (302 bytes) AFTER DECODE (300 bytes) +--------+---------------+ +---------------+ | Length | Protobuf Data |----->| Protobuf Data | | 0xAC02 | (300 bytes) | | (300 bytes) | +--------+---------------+ +---------------+
CodedInputStreamChannelHandler.Sharablecumulation, DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS| Constructor and Description |
|---|
ProtobufVarint32FrameDecoder() |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
decode(ChannelHandlerContext ctx,
Channel channel,
ChannelBuffer buffer)
Decodes the received packets so far into a frame.
|
actualReadableBytes, afterAdd, afterRemove, appendToCumulation, beforeAdd, beforeRemove, channelClosed, channelDisconnected, cleanup, decodeLast, exceptionCaught, extractFrame, getMaxCumulationBufferCapacity, getMaxCumulationBufferComponents, internalBuffer, isUnfold, messageReceived, newCumulationBuffer, replace, setMaxCumulationBufferCapacity, setMaxCumulationBufferComponents, setUnfold, unfoldAndFireMessageReceived, updateCumulationchannelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeCompleteprotected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception
FrameDecoderFrameDecoder.extractFrame(ChannelBuffer, int, int) method,
to make optimizations easier later.decode in class FrameDecoderctx - the context of this handlerchannel - the current channelbuffer - the cumulative buffer of received packets so far.
Note that the buffer might be empty, which means you
should not make an assumption that the buffer contains
at least one byte in your decoder implementation.null if there's not enough data in the buffer to decode a frame.ExceptionCopyright © 2008-2016 The Netty Project. All Rights Reserved.