mirror of
https://github.com/zhanghai/MaterialFiles
synced 2024-07-05 15:58:35 +00:00
Refactor: Use Kotlin DEFAULT_BUFFER_SIZE
This commit is contained in:
parent
bced5e6fb0
commit
79114bfefe
|
@ -10,8 +10,6 @@ import java.io.InputStream
|
|||
import java.io.InterruptedIOException
|
||||
import java.io.OutputStream
|
||||
|
||||
private const val BUFFER_SIZE = 8 * 1024
|
||||
|
||||
// Can handle ProgressCopyOption.
|
||||
@Throws(IOException::class)
|
||||
fun InputStream.copyTo(
|
||||
|
@ -19,7 +17,7 @@ fun InputStream.copyTo(
|
|||
intervalMillis: Long,
|
||||
listener: ((Long) -> Unit)?
|
||||
) {
|
||||
val buffer = ByteArray(BUFFER_SIZE)
|
||||
val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
|
||||
var lastProgressMillis = System.currentTimeMillis()
|
||||
var copiedSize = 0L
|
||||
while (true) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user