Class DataStreams.DataStreamDecoder<T>

java.lang.Object
org.apache.beam.sdk.fn.stream.DataStreams.DataStreamDecoder<T>
All Implemented Interfaces:
Iterator<T>, PrefetchableIterator<T>
Enclosing class:
DataStreams

public static class DataStreams.DataStreamDecoder<T> extends Object implements PrefetchableIterator<T>
An adapter which converts an InputStream to a PrefetchableIterator of T values using the specified Coder.

Note that this adapter follows the Beam Fn API specification for forcing values that decode consuming zero bytes to consuming exactly one byte.

Note that access to the underlying InputStream is lazy and will only be invoked on first access to next(), hasNext(), isReady(), and prefetch().

Note that isReady() and prefetch() rely on non-empty ByteStrings being returned via the underlying PrefetchableIterator otherwise the prefetch() will seemingly make zero progress yet will actually advance through the empty pages.