Created
April 3, 2015 22:52
-
-
Save kuwalab/029867ec1b9b4835851b to your computer and use it in GitHub Desktop.
CopyFile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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