public class ProtocolCodeBasedDecoder extends AbstractBatchDecoder
ChannelHandler.SharableAbstractBatchDecoder.Cumulator| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_ILLEGAL_PROTOCOL_VERSION_LENGTH
protocol version should be a positive number, we use -1 to represent illegal
|
static int |
DEFAULT_PROTOCOL_VERSION_LENGTH
by default, suggest design a single byte for protocol version.
|
protected int |
protocolCodeLength
the length of protocol code
|
COMPOSITE_CUMULATOR, MERGE_CUMULATOR| 构造器和说明 |
|---|
ProtocolCodeBasedDecoder(int protocolCodeLength) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
List<Object> out)
Decode the from one
ByteBuf to an other. |
protected ProtocolCode |
decodeProtocolCode(io.netty.buffer.ByteBuf in)
decode the protocol code
|
protected byte |
decodeProtocolVersion(io.netty.buffer.ByteBuf in)
decode the protocol version
|
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecodechannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredpublic static final int DEFAULT_PROTOCOL_VERSION_LENGTH
public static final int DEFAULT_ILLEGAL_PROTOCOL_VERSION_LENGTH
protected int protocolCodeLength
protected ProtocolCode decodeProtocolCode(io.netty.buffer.ByteBuf in)
in - input byte bufprotected byte decodeProtocolVersion(io.netty.buffer.ByteBuf in)
in - input byte bufprotected void decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
List<Object> out)
throws Exception
AbstractBatchDecoderByteBuf 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 在类中 AbstractBatchDecoderctx - the ChannelHandlerContext which this ByteToMessageDecoder belongs toin - the ByteBuf from which to read dataout - the List to which decoded messages should be addedException - is thrown if an error accourCopyright © 2020. All rights reserved.