Skip to content

Commit

Permalink
Close output stream
Browse files Browse the repository at this point in the history
  • Loading branch information
HectorNarvaez committed Aug 8, 2023
1 parent c91eab4 commit 0f805a2
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ class FileViewerViewModel @Inject constructor(
val fileToSave = File(downloadFolder, file.getNameWithExtension())
val fileOutputStream = FileOutputStream(fileToSave)

bytes.writeTo(fileOutputStream)
bytes.use { byteArrayOutputStream ->
byteArrayOutputStream.writeTo(fileOutputStream)
}
}

override fun onCleared() {
Expand Down

0 comments on commit 0f805a2

Please sign in to comment.