/** Suck up tuples from the source file. */ private Tuple readNextTuple(DataInputStream dis, int slotId) throws NoSuchElementException { // if associated bit is not set, read forward to the next tuple, and // return null. if (!getSlot(slotId)) { for (int i = 0; i < td.getSize(); i++) { try { dis.readByte(); } catch (IOException e) { throw new NoSuchElementException("error reading empty tuple"); } } return null; } // read fields in the tuple Tuple t = new Tuple(td); RecordID rid = new RecordID(pid, slotId); t.setRecordID(rid); try { for (int j = 0; j < td.numFields(); j++) { Field f = td.getType(j).parse(dis); t.setField(j, f); } } catch (java.text.ParseException e) { // e.printStackTrace(); throw new NoSuchElementException("parsing error!"); } return t; }