use of org.apache.kafka.common.record.DefaultRecordBatch in project kafka by apache.
the class RecordsIterator method nextBatch.
private Optional<Batch<T>> nextBatch() {
if (!nextBatches.hasNext()) {
nextBatches = nextBatches();
}
if (nextBatches.hasNext()) {
MutableRecordBatch nextBatch = nextBatches.next();
// Update the buffer position to reflect the read batch
allocatedBuffer.ifPresent(buffer -> buffer.position(buffer.position() + nextBatch.sizeInBytes()));
if (!(nextBatch instanceof DefaultRecordBatch)) {
throw new IllegalStateException(String.format("DefaultRecordBatch expected by record type was %s", nextBatch.getClass()));
}
return Optional.of(readBatch((DefaultRecordBatch) nextBatch));
}
return Optional.empty();
}
Aggregations