-
public final class ByteStreamReceiver extends BaseStreamReceiver<ByteArray>
Receiver for an incoming byte stream.
Provided to ByteStreamHandler callbacks registered through Room.
-
-
Field Summary
Fields Modifier and Type Field Description private final Flow<ByteArray>flowprivate final ByteStreamInfoinfo
-
Constructor Summary
Constructors Constructor Description ByteStreamReceiver(ByteStreamInfo info, Channel<ByteArray> channel)
-
Method Summary
Modifier and Type Method Description Flow<ByteArray>getFlow()A Flow of stream data as it arrives. final ByteStreamInfogetInfo()Metadata for this stream. -
-
Constructor Detail
-
ByteStreamReceiver
ByteStreamReceiver(ByteStreamInfo info, Channel<ByteArray> channel)
-
-
Method Detail
-
getFlow
Flow<ByteArray> 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 ByteStreamInfo getInfo()
Metadata for this stream.
-
-
-
-