public Row next(){
  Row r;
  if (file == null) {
    r=list.get(index++);
  }
 else {
    if (listIndex >= list.size()) {
      list.clear();
      listIndex=0;
      Data buff=rowBuff;
      buff.reset();
      int min=Constants.FILE_BLOCK_SIZE;
      file.readFully(buff.getBytes(),0,min);
      int len=buff.readInt() * Constants.FILE_BLOCK_SIZE;
      buff.checkCapacity(len);
      if (len - min > 0) {
        file.readFully(buff.getBytes(),min,len - min);
      }
      while (true) {
        r=readRow(buff);
        if (r == null) {
          break;
        }
        list.add(r);
      }
    }
    index++;
    r=list.get(listIndex++);
  }
  return r;
}

public Row next ( ) { Row r ; if ( file == null ) { r = list . get ( index ++ ) ; } else { if ( listIndex >= list . size ( ) ) { list . clear ( ) ; listIndex = 0 ; Data buff = rowBuff ; buff . reset ( ) ; int min = Constants . FILE_BLOCK_SIZE ; file . readFully ( buff . getBytes ( ) , 0 , min ) ; int len = buff . readInt ( ) * Constants . FILE_BLOCK_SIZE ; buff . checkCapacity ( len ) ; if ( len - min > 0 ) { file . readFully ( buff . getBytes ( ) , min , len - min ) ; } while ( true ) { r = readRow ( buff ) ; if ( r == null ) { break ; } list . add ( r ) ; } } index ++ ; r = list . get ( listIndex ++ ) ; } return r ; }
get the next row from the list .
