Fixup! Move tag database downloading to FileChannel based operation
This commit is contained in:
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 {
|
||||
|
||||
Reference in new issue
Block a user