private List<List<StreamRecordBatch>> groupByBlock(List<StreamRecordBatch> records) {
            List<List<StreamRecordBatch>> blocks = new LinkedList<>();
            List<StreamRecordBatch> blockRecords = new ArrayList<>(records.size());
            for (StreamRecordBatch record : records) {
                size += record.size();
                blockRecords.add(record);
                if (size >= blockSizeThreshold) {
                    blocks.add(blockRecords);
                    blockRecords = new ArrayList<>(records.size());
                    size = 0;
                }
            }
            if (!blockRecords.isEmpty()) {
                blocks.add(blockRecords);
            }
            return blocks;
        }
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