Skip to content

Instantly share code, notes, and snippets.

@abeluck
Created September 21, 2012 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abeluck/3763841 to your computer and use it in GitHub Desktop.
Save abeluck/3763841 to your computer and use it in GitHub Desktop.
IOCipher copying using file channels
...
FileOutputStream os = null;
java.io.FileInputStream is = null;
try {
os = new FileOutputStream("/test_file");
is = new java.io.FileInputStream(this.getContentResolver().openInputStream(uri));
FileChannel sourceFileChannel = is.getChannel();
IOCipherFileChannel destinationFileChannel = os.getChannel();
sourceFileChannel.transferTo(0, sourceFileChannel.size(), destinationFileChannel);
sourceFileChannel.close();
destinationFileChannel.close();
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment