Skip to content

Instantly share code, notes, and snippets.

@kuwalab
Created April 3, 2015 22:52
Show Gist options
  • Save kuwalab/029867ec1b9b4835851b to your computer and use it in GitHub Desktop.
Save kuwalab/029867ec1b9b4835851b to your computer and use it in GitHub Desktop.
CopyFile
package tips.t002
import java.nio.file.Files
import java.nio.file.Paths
fun main(args: Array<String>) {
val srcFile = Paths.get("res/test.zip")
val destFile = Paths.get("res/dest.zip")
Files.newInputStream(srcFile).use { ins ->
Files.newOutputStream(destFile).use { os ->
val size = ins.copyTo(os, bufferSize = 1024 * 8)
println("ファイルサイズ=${size}")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment