public abstract class OneToOneEncoder extends java.lang.Object implements ChannelDownstreamHandler
ChannelPipeline
pipeline = ...; // 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
ChannelDownstreamHandler
handleDownstream
在接口中 ChannelDownstreamHandler
ctx
- the context object for this handlerevt
- the downstream event to process or interceptjava.lang.Exception
protected boolean doEncode(ChannelHandlerContext ctx, MessageEvent e) throws java.lang.Exception
java.lang.Exception
protected 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