@Override public boolean nextKeyValue() throws IOException, InterruptedException {
  if (noMoreStatements) {
    return false;
  }
  nextStatement=statementCache.poll(timeoutSeconds,TimeUnit.SECONDS);
  if (nextStatement == null) {
    throw new IOException("Parser neither sending results nor signaling end of data after " + timeoutSeconds + " seconds.");
  }
 else   if (nextStatement == DONE) {
    logger.info("Reached end of parsed RDF; read " + statementCount + " statements in total.");
    nextStatement=null;
    noMoreStatements=true;
    return false;
  }
 else   if (nextStatement == ERROR) {
    nextStatement=null;
    noMoreStatements=true;
    throw new IOException("Error detected processing input.",threadException);
  }
  statementCount++;
  return true;
}

@ Override public boolean nextKeyValue ( ) throws IOException , InterruptedException { if ( noMoreStatements ) { return false ; } nextStatement = statementCache . poll ( timeoutSeconds , TimeUnit . SECONDS ) ; if ( nextStatement == null ) { throw new IOException ( "Parser neither sending results nor signaling end of data after " + timeoutSeconds + " seconds." ) ; } else if ( nextStatement == DONE ) { logger . info ( "Reached end of parsed RDF; read " + statementCount + " statements in total." ) ; nextStatement = null ; noMoreStatements = true ; return false ; } else if ( nextStatement == ERROR ) { nextStatement = null ; noMoreStatements = true ; throw new IOException ( "Error detected processing input." , threadException ) ; } statementCount ++ ; return true ; }
loads the next statement , if there is one , and returns whether there is one . receives statements from the parser thread via a blocking queue .
