public abstract class OneToOneEncoder extends java.lang.Object implements ChannelDownstreamHandler
ChannelPipelinepipeline = ...; // Decoders pipeline.addLast("frameDecoder", newDelimiterBasedFrameDecoder(80,Delimiters.nulDelimiter())); pipeline.addLast("customDecoder", newOneToOneDecoder() { ... }); // Encoder pipeline.addLast("customEncoder", newOneToOneEncoder() { ... });
ChannelHandler.Sharable| 限定符 | 构造器和说明 |
|---|---|
protected |
OneToOneEncoder() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected boolean |
doEncode(ChannelHandlerContext ctx,
MessageEvent e) |
protected abstract java.lang.Object |
encode(ChannelHandlerContext ctx,
Channel channel,
java.lang.Object msg)
Transforms the specified message into another message and return the
transformed message.
|
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent evt)
Handles the specified downstream event.
|
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
ChannelDownstreamHandlerhandleDownstream 在接口中 ChannelDownstreamHandlerctx - the context object for this handlerevt - the downstream event to process or interceptjava.lang.Exceptionprotected boolean doEncode(ChannelHandlerContext ctx, MessageEvent e) throws java.lang.Exception
java.lang.Exceptionprotected abstract java.lang.Object encode(ChannelHandlerContext ctx, Channel channel, java.lang.Object msg) throws java.lang.Exception
null, unlike
you can in OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object);
you must return something, at least ChannelBuffers.EMPTY_BUFFER.java.lang.Exception