public class ConsumerStreamingIterator<T> extends Object implements StreamingIterator<T>
StreamingIterator that takes its elements from a Consumer.
Closing this iterator will cause the underlying consumer to be closed. If for any reason the underlying consumer gets closed (either because this iterator closed it or some other reason), then this iterator will consider that it has no more items.
| Constructor and Description |
|---|
ConsumerStreamingIterator(Consumer<T> consumer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying consumer
|
int |
getSize() |
boolean |
hasNext()
Returns true as long as the underlying consumer is not fully consumed nor closed
|
T |
next()
Gets an item from the consumer and returns it
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitremoveforEachRemainingpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean hasNext()
public T next()
public int getSize()
getSize in interface org.mule.runtime.api.streaming.HasSizeCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.