Package com.google.genkit.core
Interface InputSource<I>
- Type Parameters:
I- the type of each input element
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
BufferedInputSource
A blocking pull source of inputs for a bidirectional action.
The consumer calls next() repeatedly to obtain successive inputs. When the stream is
exhausted, next() returns Optional.empty(). After that, every subsequent call
also returns empty. The close() method releases any resources held by this source.
-
Method Summary
-
Method Details
-
next
Blocks until the next input is available or the stream ends.- Returns:
- an
Optionalcontaining the next input, orOptional.empty()when the stream has ended - Throws:
InterruptedException- if the calling thread is interrupted while waiting
-
close
void close()Releases any resources held by this source. Implementations must be idempotent.- Specified by:
closein interfaceAutoCloseable
-