public boolean hasNext() { // have to actually fetch the thing
if (totalNelemsDone >= totalNelems) return false;
if ((index == null) || !index.hasNext()) { // get new data node
try {
Section dataSection;
DataChunk dataChunk;
while (true) { // look for intersecting sections
if (!chunkIterator.hasNext()) {
next = null;
return false;
}
// get next dataChunk
try {
dataChunk = chunkIterator.next();
} catch (IOException e) {
e.printStackTrace();
next = null;
return false;
}
// make the dataSection for this chunk
dataSection = new Section(dataChunk.getOffset(), chunkSize);
if (debugIntersection)
System.out.println(" test intersecting: " + dataSection + " want: " + want);
if (dataSection.intersects(want)) // does it intersect ?
break;
}
if (debug)
System.out.println(" found intersecting dataSection: " + dataSection+" intersect= "+dataSection.intersect(want));
index = new IndexChunkerTiled(dataSection, want); // new indexer into this chunk
next = new Chunk( dataChunk.getByteBuffer()); // this does the uncompression
} catch (InvalidRangeException e) {