org.fastquery.tcpserver.MessageDecoder Maven / Gradle / Ivy
The newest version!
package org.fastquery.tcpserver;
import static org.fastquery.tcpserver.Server.FIXEDTLEN;
import static org.fastquery.tcpserver.Server.START;
import java.net.InetSocketAddress;
import java.util.List;
import org.fastquery.bytes.CRC16;
import org.fastquery.bytes.ShortByteUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
// 解包
public class MessageDecoder extends ByteToMessageDecoder {
private static final Logger LOG = LoggerFactory.getLogger(MessageDecoder.class);
private Conf conf;
public MessageDecoder(Conf conf) {
this.conf = conf;
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List