Class ProtobufVarint32LengthFieldPrepender
- java.lang.Object
-
- io.netty5.channel.ChannelHandlerAdapter
-
- io.netty5.handler.codec.MessageToByteEncoder<io.netty5.buffer.Buffer>
-
- io.netty.contrib.handler.codec.protobuf.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
-
-
Constructor Summary
Constructors Constructor Description ProtobufVarint32LengthFieldPrepender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected io.netty5.buffer.BufferallocateBuffer(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.buffer.Buffer buffer)protected voidencode(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.buffer.Buffer msg, io.netty5.buffer.Buffer out)booleanisSharable()-
Methods inherited from class io.netty5.handler.codec.MessageToByteEncoder
acceptOutboundMessage, write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
-
-
-
Method Detail
-
allocateBuffer
protected io.netty5.buffer.Buffer allocateBuffer(io.netty5.channel.ChannelHandlerContext ctx, io.netty5.buffer.Buffer buffer)- Specified by:
allocateBufferin classio.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:
encodein classio.netty5.handler.codec.MessageToByteEncoder<io.netty5.buffer.Buffer>
-
isSharable
public boolean isSharable()
-
-