package com.pwt.netty.common.chargerold;

import io.netty.buffer.ByteBuf;

/**
 * @author linyun
 * @version V1.0
 * @Title: MessageData
 * @Description:
 * @date 2022/11/15
 **/
public abstract class MessageData {

    public void encode(ByteBuf byteBuf)
    {
        encodeInternal(byteBuf);
    }

    public void decode(ByteBuf byteBuf)
    {
        decodeInternal(byteBuf);
    }

    /***
     * 子类编码
     * @param byteBuf
     */
    protected abstract void encodeInternal(ByteBuf byteBuf);

    /**
     * 子类解码
     * @param byteBuf
     */
    protected abstract void decodeInternal(ByteBuf byteBuf);
}
