@ChannelHandler.Sharable public class MarshallingEncoder extends OneToOneEncoder
OneToOneEncoderimplementation which uses JBoss Marshalling to marshal an Object. Be aware that this
OneToOneEncoderis not compatible with an other client that just use JBoss Marshalling as it includes the size of every
Objectthat gets serialized in front of the
Objectitself. Use this with
MarshallingDecoderSee JBoss Marshalling website for more informations
|Constructor and Description|
Creates a new encoder with the estimated length of 512 bytes.
Creates a new encoder.
|Modifier and Type||Method and Description|
Transforms the specified message into another message and return the transformed message.
public MarshallingEncoder(MarshallerProvider provider)
public MarshallingEncoder(MarshallerProvider provider, int estimatedLength)
estimatedLength- the estimated byte length of the serialized form of an object. If the length of the serialized form exceeds this value, the internal buffer will be expanded automatically at the cost of memory bandwidth. If this value is too big, it will also waste memory bandwidth. To avoid unnecessary memory copy or allocation cost, please specify the properly estimated value.
protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception
null, unlike you can in
OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object); you must return something, at least
Copyright © 2008-2014 The Netty Project. All Rights Reserved.