private static Version getMagic(ByteBuffer buffer) {
        // #lizard forgives
        byte[] array = buffer.array();
        if (buffer.remaining() < 4) {
            return Version.vn;
        }
        int pos = buffer.position();
        int rem = buffer.remaining();
        if (array[pos] == MAGIC1[0] && array[pos + 1] == MAGIC1[1]
                && array[pos + rem - 2] == MAGIC1[0]
                && array[pos + rem - 1] == MAGIC1[1]) {
            return Version.v1;
        }
        if (array[pos] == MAGIC2[0] && array[pos + 1] == MAGIC2[1]
                && array[pos + rem - 2] == MAGIC2[0]
                && array[pos + rem - 1] == MAGIC2[1]) {
            return Version.v2;
        }
        if (array[pos] == MAGIC3[0] && array[pos + 1] == MAGIC3[1]
                && array[pos + rem - 2] == MAGIC3[0]
                && array[pos + rem - 1] == MAGIC3[1]) {
            return Version.v3;
        }
        if (array[pos] == MAGIC4[0] && array[pos + 1] == MAGIC4[1]
                && array[pos + rem - 2] == MAGIC4[0]
                && array[pos + rem - 1] == MAGIC4[1]) {
            return Version.v4;
        }
        if (array[pos] == MAGIC0[0] && array[pos + 1] == MAGIC0[1]
                && array[pos + rem - 2] == MAGIC0[0]
                && array[pos + rem - 1] == MAGIC0[1]) {
            return Version.v0;
        }
        return Version.vn;
    }
add msg
@param attr
@param data
@return
inlong-common/src/main/java/org/apache/inlong/common/msg/InLongMsg.java