public class ProtobufVarint32FrameDecoder extends ByteToMessageDecoder
ByteBuf 。
例如:
BEFORE DECODE (302 bytes) AFTER DECODE (300 bytes)
+--------+---------------+ +---------------+
| Length | Protobuf Data |----->| Protobuf Data |
| 0xAC02 | (300 bytes) | | (300 bytes) |
+--------+---------------+ +---------------+
CodedInputStream , CodedInputByteBufferNano
ByteToMessageDecoder.CumulatorChannelHandler.SharableCOMPOSITE_CUMULATOR, MERGE_CUMULATOR| Constructor and Description |
|---|
ProtobufVarint32FrameDecoder() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out)
解码从一个 ByteBuf到另一个。
|
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, handlerAdded, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAddedprotected void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
ByteToMessageDecoder
decode在课程
ByteToMessageDecoder
ctx - 这ByteToMessageDecoder属于的ChannelHandlerContext
in - 从中读取数据的ByteBuf
out - 应该添加解码消息的
List
java.lang.Exception - 发生错误时抛出
Copyright © 2008–2018 The Netty Project. All rights reserved.