Fixup! Move tag database downloading to FileChannel based operation

This commit is contained in:
tarsin committed 2023-02-18 13:07:26 +08:00
1 parent 61fd8dc778
commit a644a1cee1
1 file changed
+1 -3
@@ -4,13 +4,11 @@ import okhttp3.ResponseBody
import java.io.File
fun ResponseBody.copyToFile(file: File) {
val length = contentLength()
check(length > 0) { "contentLength < 0!" }
val os = file.outputStream()
val channel = os.channel
val source = source()
try {
channel.transferFrom(source, 0, length)
channel.transferFrom(source, 0, Long.MAX_VALUE)
} catch (e: Throwable) {
throw e
} finally {