Skip to content

Commit 36e05e9

Browse files
authored
Properly return Result on ByteStreamSender convenience methods (#709)
1 parent 98909c1 commit 36e05e9

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

.changeset/fuzzy-suits-knock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"client-sdk-android": patch
3+
---
4+
5+
Properly return Result on ByteStreamSender convenience methods

livekit-android-sdk/src/main/java/io/livekit/android/room/datastream/outgoing/ByteStreamSender.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.livekit.android.room.datastream.outgoing
1818

19+
import androidx.annotation.CheckResult
1920
import io.livekit.android.room.datastream.ByteStreamInfo
2021
import okio.Buffer
2122
import okio.FileSystem
@@ -53,20 +54,23 @@ private val byteDataChunker: DataChunker<ByteArray> = { data: ByteArray, chunkSi
5354
/**
5455
* Reads the file from [filePath] and writes it to the data stream.
5556
*/
56-
suspend fun ByteStreamSender.writeFile(filePath: String) {
57-
write(FileSystem.SYSTEM.source(filePath.toPath()))
57+
@CheckResult
58+
suspend fun ByteStreamSender.writeFile(filePath: String): Result<Unit> {
59+
return write(FileSystem.SYSTEM.source(filePath.toPath()))
5860
}
5961

6062
/**
6163
* Reads the input stream and sends it to the data stream.
6264
*/
63-
suspend fun ByteStreamSender.write(input: InputStream) {
64-
write(input.source())
65+
@CheckResult
66+
suspend fun ByteStreamSender.write(input: InputStream): Result<Unit> {
67+
return write(input.source())
6568
}
6669

6770
/**
6871
* Reads the source and sends it to the data stream.
6972
*/
73+
@CheckResult
7074
suspend fun ByteStreamSender.write(source: Source): Result<Unit> {
7175
val buffer = Buffer()
7276
while (true) {

0 commit comments

Comments
 (0)