@ChannelHandler.Sharable public class ProtobufVarint32LengthFieldPrepender extends MessageToByteEncoder<ByteBuf>
BEFORE DECODE (300 bytes) AFTER DECODE (302 bytes) +---------------+ +--------+---------------+ | Protobuf Data |-------------->| Length | Protobuf Data | | (300 bytes) | | 0xAC02 | (300 bytes) | +---------------+ +--------+---------------+*
CodedOutputStreamChannelHandler.Sharable| Constructor and Description |
|---|
ProtobufVarint32LengthFieldPrepender()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
encode(ChannelHandlerContext ctx,
ByteBuf msg,
ByteBuf out) |
boolean |
isEncodable(Object msg)
Returns
true if and only if the specified message can be encoded by this encoder. |
flushnewOutboundBufferafterAdd, afterRemove, beforeAdd, beforeRemove, bind, close, connect, deregister, disconnect, exceptionCaught, userEventTriggeredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbind, close, connect, deregister, disconnectafterAdd, afterRemove, beforeAdd, beforeRemove, exceptionCaught, userEventTriggeredpublic ProtobufVarint32LengthFieldPrepender()
public boolean isEncodable(Object msg) throws Exception
MessageToByteEncodertrue if and only if the specified message can be encoded by this encoder.isEncodable in class MessageToByteEncoder<ByteBuf>msg - the messageExceptionpublic void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception
encode in class MessageToByteEncoder<ByteBuf>ExceptionCopyright © 2008-2012 The Netty Project. All Rights Reserved.