package com.jiayue.ipfcst.fileupload.IEC102;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import lombok.extern.slf4j.Slf4j;

import java.math.BigInteger;

/**
 * 102编码器
 *
 * @author xsl
 * @version 3.0
 */
public class ServerFor102Encoder extends MessageToByteEncoder<String> {
    @Override
    protected void encode(ChannelHandlerContext ctx, String msg, ByteBuf out) throws Exception {
      BigInteger bigint=new BigInteger(msg, 16);
      out.writeBytes(bigint.toByteArray());
    }
}
