void sanityCheck(GetObjectsContext ctx, List<S3ObjectMetadata> objects) {
        if (objects.size() > ctx.limit) {
            throw new IllegalArgumentException(String.format("number of objects %d exceeds limit %d", objects.size(), ctx.limit));
        }
        long nextStartOffset = -1L;
        for (S3ObjectMetadata object : objects) {
            StreamOffsetRange range = findStreamOffsetRange(object.getOffsetRanges(), ctx.streamId);
            if (range == null) {
                throw new IllegalArgumentException(String.format("range not found in object %s", object));
            }
            if (nextStartOffset == -1L) {
                if (range.startOffset() > ctx.startOffset) {
                    throw new IllegalArgumentException(String.format("first matched range %s in object %s is greater than" +
                        " requested start offset %d", range, object, ctx.startOffset));
                }
            } else if (nextStartOffset != range.startOffset()) {
                throw new IllegalArgumentException(String.format("range is not continuous, expected start offset %d," +
                    " actual %d in object %s", nextStartOffset, range.startOffset(), object));
            }
            nextStartOffset = range.endOffset();
        }
    }
Check for continuity of stream range and range matching.
Note: insufficient range is possible and caller should retry after
metadata/src/main/java/org/apache/kafka/image/S3StreamsMetadataImage.java