{
size = tupleInputStream.readLong();
}
catch( IOException exception )
{
throw new TupleException( "unable to read 'size' of collection from file input stream", exception );
}
return new CloseableIterator<Tuple>()
{
Tuple tuple = new Tuple();
long count = 0;
@Override
public boolean hasNext()
{
return count < size;
}
@Override
public Tuple next()
{
try
{
return tupleInputStream.readTuple( tuple );
}
catch( IOException exception )
{
throw new TupleException( "unable to read next tuple from file input stream containing: " + size + " tuples, successfully read tuples: " + count, exception );
}
finally
{
count++;
}