diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/util/FileSaver.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/util/FileSaver.kt index 9654f5e097..4f695d2c74 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/util/FileSaver.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/util/FileSaver.kt @@ -26,11 +26,8 @@ import java.io.InputStream */ @WorkerThread fun writeToFile(inputStream: InputStream, outputFile: File) { - val source = Okio.buffer(Okio.source(inputStream)) - val sink = Okio.buffer(Okio.sink(outputFile)) - - source.use { input -> - sink.use { output -> + Okio.buffer(Okio.source(inputStream)).use { input -> + Okio.buffer(Okio.sink(outputFile)).use { output -> output.writeAll(input) } }