Class MessageToMessageDecoder<I>

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.MessageToMessageDecoder<I>
All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler
Direct Known Subclasses:
Base64Decoder, ByteArrayDecoder, DatagramDnsQueryDecoder, DatagramDnsResponseDecoder, DatagramPacketDecoder, HttpContentDecoder, MessageAggregator, ProtobufDecoder, ProtobufDecoderNano, RedisArrayAggregator, SctpInboundByteStreamHandler, SctpMessageCompletionHandler, SctpMessageToMessageDecoder, SpdyHttpDecoder, StringDecoder, WebSocketClientProtocolHandler, WebSocketExtensionDecoder, WebSocketServerProtocolHandler

public abstract class MessageToMessageDecoder<I> extends ChannelInboundHandlerAdapter
ChannelInboundHandlerAdapter 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> {
 @Override
 public void decode(ChannelHandlerContext ctx, String message,
 List<Object> out) throws Exception {
 out.add(message.length());
 }
 }
Be aware that you need to call ReferenceCounted.retain() on messages that are just passed through if they are of type ReferenceCounted. This is needed as the MessageToMessageDecoder will call ReferenceCounted.release() on decoded messages.