Class ProtobufVarint32LengthFieldPrepender

All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler

@Sharable public class ProtobufVarint32LengthFieldPrepender extends MessageToByteEncoder<ByteBuf>
An encoder that prepends the Google Protocol Buffers Base 128 Varints integer length field. For example:
 BEFORE ENCODE (300 bytes)       AFTER ENCODE (302 bytes)
 +---------------+               +--------+---------------+
 | Protobuf Data |-------------->| Length | Protobuf Data |
 |  (300 bytes)  |               | 0xAC02 |  (300 bytes)  |
 +---------------+               +--------+---------------+
 
*
See Also:
  • CodedOutputStream
  • CodedOutputByteBufferNano