package com.lyncc.netty.codec.jackson;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
public class UserEncoder extends MessageToByteEncoder<Object>{
@Override
protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
ByteBufOutputStream byteBufOutputStream = new ByteBufOutputStream(out);
UserMapper.getInstance().writeValue(byteBufOutputStream, msg);
}
}