-
public final class TextStreamReceiver extends BaseStreamReceiver<String>
Receiver for an incoming text stream.
Chunks are decoded as UTF-8 strings. Provided to TextStreamHandler callbacks registered through Room.
-
-
Field Summary
Fields Modifier and Type Field Description private final Flow<String>flowprivate final TextStreamInfoinfo
-
Constructor Summary
Constructors Constructor Description TextStreamReceiver(TextStreamInfo info, Channel<ByteArray> source)
-
Method Summary
Modifier and Type Method Description Flow<String>getFlow()A Flow of stream data as it arrives. final TextStreamInfogetInfo()Metadata for this stream. -
-
Constructor Detail
-
TextStreamReceiver
TextStreamReceiver(TextStreamInfo info, Channel<ByteArray> source)
-
-
Method Detail
-
getFlow
Flow<String> getFlow()
A Flow of stream data as it arrives.
Collect this flow to process incoming data incrementally. The flow completes normally when the stream receives all the data without error. If the stream ends abnormally, the flow fails with a StreamException after all buffered chunks have been emitted.
Example:
reader.flow .catch { e -> if (e is StreamException) { handleStreamError(e) } else { throw e } } .collect { chunk -> process(chunk) }
-
getInfo
final TextStreamInfo getInfo()
Metadata for this stream.
-
-
-
-