Class ProtobufVarint32FrameDecoder

  • All Implemented Interfaces:
    ChannelHandler, ChannelInboundHandler

    public class ProtobufVarint32FrameDecoder
    extends ByteToMessageDecoder
    A decoder that splits the received ByteBufs 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)  |
     +--------+---------------+      +---------------+
     
    See Also:
    CodedInputStream, CodedInputByteBufferNano
    • Constructor Detail

      • ProtobufVarint32FrameDecoder

        public ProtobufVarint32FrameDecoder()
        Creates a new instance with no frame length limit.
      • ProtobufVarint32FrameDecoder

        public ProtobufVarint32FrameDecoder​(int maxFrameLength)
        Creates a new instance with the specified maximum frame length.
        Parameters:
        maxFrameLength - the maximum length of the frame. If the length exceeds this value, TooLongFrameException will be thrown.