public boolean addMsg(String attr, ByteBuffer data) {
        checkMode(true);

        if ((version.intValue() == Version.v3.intValue())
                && !checkData(data)) {
            return false;
        }

        DataBuffer outputBuffer = attr2MsgBuffer.computeIfAbsent(attr, k -> new DataBuffer());
        // attrlen + utflen + meglen + compress
        this.datalen += attr.length() + 2 + 4 + 1;

        int len = data.remaining();
        try {
            outputBuffer.write(data.array(), data.position(), len);
            this.datalen += len + 4;
            if (version.intValue() == Version.v2.intValue()) {
                this.datalen += 4;
            }
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        msgcnt++;
        return checkLen(attr, len);
    }
add msg
@param attr
@param data
@return
inlong-common/src/main/java/org/apache/inlong/common/msg/InLongMsg.java