public abstract class MessageToMessageDecoder<I>
extends io.netty.channel.ChannelInboundMessageHandlerAdapter<I>
ChannelInboundMessageHandler which decodes from one message to an other message
For example here is an implementation which decodes a String to an Integer which represent
the length of the String.
public class StringToIntegerDecoder extends
MessageToMessageDecoder<String> {
public StringToIntegerDecoder() {
super(String.class);
}
@Override
public Object decode(ChannelHandlerContext ctx, String message)
throws Exception {
return message.length());
}
}
| Constructor and Description |
|---|
MessageToMessageDecoder() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Object |
decode(io.netty.channel.ChannelHandlerContext ctx,
I msg)
Decode from one message to an other.
|
void |
messageReceived(io.netty.channel.ChannelHandlerContext ctx,
I msg) |
acceptInboundMessage, beginMessageReceived, endMessageReceived, freeInboundBuffer, inboundBufferUpdated, newInboundBufferchannelActive, channelInactive, channelReadSuspended, channelRegistered, channelUnregistered, userEventTriggeredafterAdd, afterRemove, beforeAdd, beforeRemove, exceptionCaughtclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic final void messageReceived(io.netty.channel.ChannelHandlerContext ctx,
I msg)
throws Exception
Exceptionprotected abstract Object decode(io.netty.channel.ChannelHandlerContext ctx, I msg) throws Exception
MessageBuf has
nothing left or till this method returns null.ctx - the ChannelHandlerContext which this MessageToMessageDecoder belongs tomsg - the message to decode to an other onenull if more messages are needed be cause the implementation
needs to do some kind of aggragationException - is thrown if an error accourCopyright © 2008-2013 The Netty Project. All Rights Reserved.