Created
March 11, 2015 05:10
-
-
Save hunje/61fa60ae292ac150e1f0 to your computer and use it in GitHub Desktop.
Copy File Android
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
public static void copyFile(File src, File target) throws FileNotFoundException, IOException { | |
FileInputStream inStream = new FileInputStream(src); | |
FileOutputStream outStream = new FileOutputStream(target); | |
FileChannel inChannel = inStream.getChannel(); | |
FileChannel outChannel = outStream.getChannel(); | |
inChannel.transferTo(0, inChannel.size(), outChannel); | |
inStream.close(); | |
outStream.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment