private ByteBuffer defaultBuild(long createtime) {
        try {
            this.createtime = createtime;
            DataOutputBuffer out = new DataOutputBuffer(capacity);

            writeHeader(out);
            out.writeInt(attr2MsgBuffer.size());

            if (compress) {
                for (Map.Entry<String, DataBuffer> entry : attr2MsgBuffer.entrySet()) {
                    String attr = entry.getKey();
                    DataBuffer data = entry.getValue();
                    out.writeUTF(attr);
                    if (version.intValue() == Version.v2.intValue()) {
                        out.writeInt(data.cnt);
                    }
                    int guessLen =
                            Snappy.maxCompressedLength(data.out.getLength());
                    byte[] tmpData = new byte[guessLen];
                    int len = Snappy.compress(data.out.getData(), 0,
                            data.out.getLength(), tmpData, 0);
                    out.writeInt(len + 1);
                    out.writeBoolean(compress);
                    out.write(tmpData, 0, len);
                }
            } else {
                for (Map.Entry<String, DataBuffer> entry : attr2MsgBuffer.entrySet()) {
                    String attr = entry.getKey();
                    DataBuffer data = entry.getValue();
                    out.writeUTF(attr);
                    if (version.intValue() == Version.v2.intValue()) {
                        out.writeInt(data.cnt);
                    }
                    out.writeInt(data.out.getLength() + 1);
                    out.writeBoolean(compress);
                    out.write(data.out.getData(), 0, data.out.getLength());
                }
            }
            writeMagic(out);
            out.close();
            return ByteBuffer.wrap(out.getData(), 0, out.getLength());
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
add msg
@param attr
@param data
@return
inlong-common/src/main/java/org/apache/inlong/common/msg/InLongMsg.java