Chunk reading in Spring Batch - not only chunk writing
This is a draft for an implementation of the read() interface method.
public T read() throws Exception {
while (this.items.isEmpty()) {
final List<T> newItems = readChunk();
if (newItems == null) {
return null;
}
this.items.addAll(newItems);
}
return this.items.pop();
}
Please note, that items
is a buffer for the items read in chunks and not requested by the framework yet.