package com.manning.nettyinaction.chapter7;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.List;
/**
* Listing 7.8 of <i>Netty in Action</i>
*
* @author <a href="mailto:norman.maurer@googlemail.com">Norman Maurer</a>
*/
public class ByteToCharDecoder extends
ByteToMessageDecoder {
@Override
public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
throws Exception {
if (in.readableBytes() >= 2) {
out.add(in.readChar());
}
}
}