Class ProtobufVarint32LengthFieldPrepender

  • All Implemented Interfaces:
    io.netty5.channel.ChannelHandler

    public class ProtobufVarint32LengthFieldPrepender
    extends io.netty5.handler.codec.MessageToByteEncoder<io.netty5.buffer.Buffer>
    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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected io.netty5.buffer.Buffer allocateBuffer​(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.buffer.Buffer buffer)  
      protected void encode​(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.buffer.Buffer msg, io.netty5.buffer.Buffer out)  
      boolean isSharable()  
      • Methods inherited from class io.netty5.handler.codec.MessageToByteEncoder

        acceptOutboundMessage, write
      • Methods inherited from interface io.netty5.channel.ChannelHandler

        bind, channelActive, channelExceptionCaught, channelInactive, channelInboundEvent, channelRead, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown
    • Constructor Detail

      • ProtobufVarint32LengthFieldPrepender

        public ProtobufVarint32LengthFieldPrepender()
    • Method Detail

      • allocateBuffer

        protected io.netty5.buffer.Buffer allocateBuffer​(io.netty5.channel.ChannelHandlerContext ctx,
                                                         io.netty5.buffer.Buffer buffer)
        Specified by:
        allocateBuffer in class io.netty5.handler.codec.MessageToByteEncoder<io.netty5.buffer.Buffer>
      • encode

        protected void encode​(io.netty5.channel.ChannelHandlerContext ctx,
                              io.netty5.buffer.Buffer msg,
                              io.netty5.buffer.Buffer out)
        Specified by:
        encode in class io.netty5.handler.codec.MessageToByteEncoder<io.netty5.buffer.Buffer>
      • isSharable

        public boolean isSharable()