Skip to content

Instantly share code, notes, and snippets.

@hunje
Created March 11, 2015 05:10
Show Gist options
  • Save hunje/61fa60ae292ac150e1f0 to your computer and use it in GitHub Desktop.
Save hunje/61fa60ae292ac150e1f0 to your computer and use it in GitHub Desktop.
Copy File Android
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