Last active
May 12, 2020 08:40
-
-
Save alvindizon/2d5ecbe678e572726c47a491c8bfc0fc to your computer and use it in GitHub Desktop.
copy file in java using NIO
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
try(FileChannel in = new FileInputStream(src).getChannel(); | |
FileChannel out = new FileOutputStream(dest).getChannel() ) { | |
in.transferTo(0, in.size(), out); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment