Package com.flagright.api.core
Class Stream<T>
- java.lang.Object
-
- com.flagright.api.core.Stream<T>
-
- Type Parameters:
T- The type of objects in the stream.
- All Implemented Interfaces:
java.lang.Iterable<T>
public final class Stream<T> extends java.lang.Object implements java.lang.Iterable<T>TheStreamclass implementsIterableto provide a simple mechanism for reading and parsing objects of a given type from data streamed via aReaderusing a specified delimiter.Streamassumes that data is being pushed to the providedReaderasynchronously and utilizes aScannerto block during iteration if the next object is not available.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<T>iterator()Returns an iterator over the elements in this stream that blocks during iteration when the next object is not yet available.
-
-
-
Constructor Detail
-
Stream
public Stream(java.lang.Class<T> valueType, java.io.Reader reader, java.lang.String delimiter)
Constructs a newStreamwith the specified value type, reader, and delimiter.- Parameters:
valueType- The class of the objects in the stream.reader- The reader that provides the streamed data.delimiter- The delimiter used to separate elements in the stream.
-
-
Method Detail
-
iterator
public java.util.Iterator<T> iterator()
Returns an iterator over the elements in this stream that blocks during iteration when the next object is not yet available.- Specified by:
iteratorin interfacejava.lang.Iterable<T>- Returns:
- An iterator that can be used to traverse the elements in the stream.
-
-