public abstract class OneToOneEncoder extends Object implements ChannelDownstreamHandler
ChannelPipeline
pipeline = ...; // 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 Object |
encode(ChannelHandlerContext ctx,
Channel channel,
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 Exception
ChannelDownstreamHandler
handleDownstream
in interface ChannelDownstreamHandler
ctx
- the context object for this handlerevt
- the downstream event to process or interceptException
protected boolean doEncode(ChannelHandlerContext ctx, MessageEvent e) throws Exception
Exception
protected abstract 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 ChannelBuffers.EMPTY_BUFFER
.Exception
Copyright © 2008-2013 The Netty Project. All Rights Reserved.