xin.alum.aim.coder.TEXTDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aim-starter Show documentation
Show all versions of aim-starter Show documentation
aim-starter 基于netty的WebSocket和Socket通信包
package xin.alum.aim.coder;
import io.netty.util.ReferenceCountUtil;
import xin.alum.aim.config.DataAgreement;
import xin.alum.aim.constant.AIMConstant;
import xin.alum.aim.constant.ChannelAttr;
import xin.alum.aim.model.Sent;
import xin.alum.aim.util.JSONUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.DelimiterBasedFrameDecoder;
import io.netty.handler.codec.Delimiters;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.util.CharsetUtil;
import java.util.ArrayList;
import java.util.List;
/**
* @auther Alum(alum @ live.cn)
* @date 2021/8/20 18:44
*/
public class TEXTDecoder extends StringDecoder {
public TEXTDecoder() {
super(CharsetUtil.UTF_8);
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List