public abstract class OneToOneDecoder extends java.lang.Object implements ChannelUpstreamHandler
FrameDecoder
such as
DelimiterBasedFrameDecoder
or you must implement proper framing
mechanism by yourself if you are using a stream-based transport such as
TCP/IP. A typical setup for TCP/IP would be:
ChannelPipeline
pipeline = ...; // Decoders pipeline.addLast("frameDecoder", newDelimiterBasedFrameDecoder
(80,Delimiters.nulDelimiter()
)); pipeline.addLast("customDecoder", newOneToOneDecoder
() { ... }); // Encoder pipeline.addLast("customEncoder", newOneToOneEncoder
() { ... });
ChannelHandler.Sharable
限定符 | 构造器和说明 |
---|---|
protected |
OneToOneDecoder()
Creates a new instance with the current system character set.
|
限定符和类型 | 方法和说明 |
---|---|
protected abstract java.lang.Object |
decode(ChannelHandlerContext ctx,
Channel channel,
java.lang.Object msg)
Transforms the specified received message into another message and return
the transformed message.
|
void |
handleUpstream(ChannelHandlerContext ctx,
ChannelEvent evt)
Handles the specified upstream event.
|
protected OneToOneDecoder()
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
ChannelUpstreamHandler
handleUpstream
在接口中 ChannelUpstreamHandler
ctx
- the context object for this handlerevt
- the upstream event to process or interceptjava.lang.Exception
protected abstract java.lang.Object decode(ChannelHandlerContext ctx, Channel channel, java.lang.Object msg) throws java.lang.Exception
null
if the received message
is supposed to be discarded.java.lang.Exception