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| Modifier | Constructor and Description |
|---|---|
protected |
OneToOneEncoder() |
| Modifier and Type | Method and Description |
|---|---|
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 in interface 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