public static StreamRecordBatch decode(ByteBuf buf, boolean retain) {
        buf.readByte(); // magic
        long streamId = buf.readLong();
        long epoch = buf.readLong();
        long baseOffset = buf.readLong();
        int lastOffsetDelta = buf.readInt();
        int payloadLength = buf.readInt();
        ByteBuf payload = retain ? buf.retainedSlice(buf.readerIndex(), payloadLength) : buf.slice(buf.readerIndex(), payloadLength);
        buf.skipBytes(payloadLength);
        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 shares the payload buffer with the input buffer.
s3stream/src/main/java/com/automq/stream/s3/StreamRecordBatchCodec.java