private void check(long streamId, List<StreamRecordBatch> records) {
            if (records.isEmpty()) {
                return;
            }
            long recordsEndOffset = records.get(records.size() - 1).getLastOffset();
            if (lastStreamId == Constants.NOOP_STREAM_ID) {
                lastStreamId = streamId;
                lastEndOffset = recordsEndOffset;
                return;
            }
            if (lastStreamId > streamId) {
                throw new IllegalArgumentException(String.format("The incoming streamId=%s is less than last streamId=%s", streamId, lastStreamId));
            } else if (lastStreamId == streamId) {
                long recordsStartOffset = records.get(0).getBaseOffset();
                if (recordsStartOffset < lastEndOffset) {
                    throw new IllegalArgumentException(String.format("The incoming streamId=%s startOffset=%s is less than lastEndOffset=%s",
                        streamId, recordsStartOffset, lastEndOffset));
                } else {
                    lastEndOffset = recordsEndOffset;
                }
            } else {
                lastStreamId = streamId;
                lastEndOffset = recordsEndOffset;
            }
        }
Create a new object writer.

@param objectId           object id
@param objectStorage      S3 operator
@param blockSizeThreshold the max size of a block
@param partSizeThreshold  the max size of a part. If it is smaller than {@link Writer#MIN_PART_SIZE}, it will be set to {@link Writer#MIN_PART_SIZE}.
@param writeOptions       the object storage write options
s3stream/src/main/java/com/automq/stream/s3/ObjectWriter.java