@ChannelHandler.Sharable public class ProtobufVarint32LengthFieldPrepender extends OneToOneEncoder
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 |
|---|---|
protected Object |
encode(ChannelHandlerContext ctx,
Channel channel,
Object msg)
Transforms the specified message into another message and return the
transformed message.
|
handleDownstreampublic ProtobufVarint32LengthFieldPrepender()
protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception
OneToOneEncodernull, unlike
you can in OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object);
you must return something, at least ChannelBuffers.EMPTY_BUFFER.encode in class OneToOneEncoderExceptionCopyright © 2008-2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.