|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
E - the type of elements iterated overpublic interface Stream<E>
An iterator over the elements of a dataset of arbitrary origin, including memory, secondary storage, and network.
Streams are:
Iterators, including StreamExceptions.
Independently from failure handling strategies, the recommended idiom for stream consumption is the following:
Stream<T> stream = ...
try {
while (stream.hasNext())
....stream.next()...
}
finally {
stream.close();
}
| Method Summary | |
|---|---|
void |
close()
Closes the stream unconditionally, releasing any resources that it may be using. |
boolean |
hasNext()
Returns true if the stream has more elements. |
URI |
locator()
Returns the stream locator. |
E |
next()
|
| Methods inherited from interface java.util.Iterator |
|---|
remove |
| Method Detail |
|---|
boolean hasNext()
true if the stream has more elements.
hasNext in interface Iterator<E>true if the stream has more elements and has not been closed.
E next()
throws StreamException
next in interface Iterator<E>NoSuchElementException - if the stream has no more elements or it has been closed.
StreamContingencyException - if the element cannot be returned due to a recoverable error
StreamOpenException - if the stream cannot be opened for iteration (unrecoverable)
RuntimeException - if the element cannot be returned due to a generic unrecoverable outage or error
StreamException
URI locator()
throws IllegalStateException
IllegalStateException - if the stream is no longer addressable at the time of invocation.void close()
Subsequent invocations of this method have no effect.
Subsequents invocations of hasNext() return false.
Subsequent invocations of next()
throw NoSuchElementExceptions.
Failures are logged by implementations and are otherwise suppressed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||