T - the observed typeU - the returned value typepublic abstract class ObserverToIteratorSink<T,U> extends java.lang.Object implements Observer<T>, CloseableIterator<U>
| Modifier and Type | Field and Description |
|---|---|
protected SingleOption<U> |
current
The current value.
|
protected boolean |
done
Indicate that the stream has finished.
|
protected java.io.Closeable |
handle
The original handle to the observer registration.
|
| Constructor and Description |
|---|
ObserverToIteratorSink(java.io.Closeable handle)
Constructor, saves the handle.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
done()
Closes this iterator and suppresses exceptions.
|
boolean |
hasNext() |
U |
next() |
void |
remove() |
abstract boolean |
tryNext(SingleOption<? super U> out)
Try to get the next value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waiterror, finishprotected boolean done
@Nonnull protected final java.io.Closeable handle
@Nonnull protected final SingleOption<U> current
public ObserverToIteratorSink(@Nonnull
java.io.Closeable handle)
handle - the handle to close when the stream finishes.public boolean hasNext()
hasNext in interface java.util.Iterator<U>public void remove()
remove in interface java.util.Iterator<U>public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionprotected void done()
public abstract boolean tryNext(@Nonnull
SingleOption<? super U> out)
out - the output where to put the value