@ChannelHandler.Sharable public class MarshallingEncoder extends MessageToByteEncoder<java.lang.Object>
MessageToByteEncoder使用JBoss编组来封送对象的实现。
请注意,此编码器与仅使用JBoss编组的其他客户端不兼容,因为它包含在Object本身前面序列化的每个Object的大小。
与MarshallingDecoder 一起使用请参阅JBoss Marshalling website了解更多信息
ChannelHandler.Sharable| Constructor and Description |
|---|
MarshallingEncoder(MarshallerProvider provider)
创建一个新的编码器。
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
encode(ChannelHandlerContext ctx, java.lang.Object msg, ByteBuf out)
将消息编码成 ByteBuf 。
|
acceptOutboundMessage, allocateBuffer, isPreferDirect, writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedpublic MarshallingEncoder(MarshallerProvider provider)
provider - 使用MarshallerProvider
protected void encode(ChannelHandlerContext ctx, java.lang.Object msg, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf 。
这个方法将被编码器处理的每个书面信息调用。
encode在课堂上
MessageToByteEncoder<java.lang.Object>
ctx - MessageToByteEncoder属于的ChannelHandlerContext
msg - 要编码的消息
out - 编码消息将写入其中的ByteBuf
java.lang.Exception - is thrown if an error occurs
Copyright © 2008–2018 The Netty Project. All rights reserved.