public static StreamRecordBatch duplicateDecode(ByteBuf buf) {
        byte magic = buf.readByte(); // magic
        if (magic != MAGIC_V0) {
            throw new RuntimeException("Invalid magic byte " + magic);
        }
        long streamId = buf.readLong();
        long epoch = buf.readLong();
        long baseOffset = buf.readLong();
        int lastOffsetDelta = buf.readInt();
        int payloadLength = buf.readInt();
        ByteBuf payload = ByteBufAlloc.byteBuffer(payloadLength, ByteBufAlloc.DECODE_RECORD);
        buf.readBytes(payload);
        return new StreamRecordBatch(streamId, epoch, baseOffset, lastOffsetDelta, payload);
    }
Decode a stream record batch from a byte buffer and move the reader index.
The returned stream record batch does NOT share the payload buffer with the input buffer.
s3stream/src/main/java/com/automq/stream/s3/StreamRecordBatchCodec.java