Skip to content

Commit

Permalink
Use copyTo to copy streams
Browse files Browse the repository at this point in the history
  • Loading branch information
davotoula committed Oct 8, 2024
1 parent cdc8850 commit af28e6d
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ object MediaCompressorFileUtils {
input: InputStream,
output: OutputStream,
) {
val buffer = ByteArray(1024 * 50)
var read = input.read(buffer)
while (read != -1) {
output.write(buffer, 0, read)
read = input.read(buffer)
}
input.copyTo(output, bufferSize = 1024 * 50)
}

private fun splitFileName(fileName: String): Pair<String, String> {
Expand Down

0 comments on commit af28e6d

Please sign in to comment.