You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/01/25 18:01:06 UTC
svn commit: r1438588 -
/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/StreamedRDFIterator.java
Author: rvesse
Date: Fri Jan 25 17:01:05 2013
New Revision: 1438588
URL: http://svn.apache.org/viewvc?rev=1438588&view=rev
Log:
Simplify StreamedRDFIterator slightly
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/StreamedRDFIterator.java
Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/StreamedRDFIterator.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/StreamedRDFIterator.java?rev=1438588&r1=1438587&r2=1438588&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/StreamedRDFIterator.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/StreamedRDFIterator.java Fri Jan 25 17:01:05 2013
@@ -148,15 +148,12 @@ public abstract class StreamedRDFIterato
public final T next() {
if (!this.started) {
throw new IllegalStateException("Tried to read from iterator before the Stream was started, please ensure that a producer thread has called start() on the stream before attempting to iterate over it");
- } else if (this.next != null) {
+ } else if (this.hasNext()) {
T t = this.next;
this.next = null;
return t;
- } else if (this.finished && buffer.isEmpty()) {
- throw new NoSuchElementException();
} else {
- this.getNext();
- return this.next;
+ throw new NoSuchElementException();
}
}
@@ -172,6 +169,15 @@ public abstract class StreamedRDFIterato
}
this.started = true;
}
+
+ /**
+ * Returns whether it is safe to start iterating, this is the case if the {@link #start()}
+ * method of the stream has been called
+ * @return True if safe to iterate
+ */
+ public final boolean canIterate() {
+ return this.started;
+ }
@Override
public final void base(String base) {