Created
February 29, 2016 09:18
-
-
Save Jaymo/3ba1a52d6c4b815f81ee to your computer and use it in GitHub Desktop.
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
private final static int DEFAULT_READ_WRITE_BLOCK_BUFFER_SIZE = 1024; | |
public static void applyCipher(String inFile, String outFile, Cipher cipher) throws Exception { | |
CipherInputStream in = new CipherInputStream(new FileInputStream(inFile), cipher); | |
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outFile)); | |
byte[] buffer = new byte[DEFAULT_READ_WRITE_BLOCK_BUFFER_SIZE]; | |
int count = 0; | |
while ((count = in.read(buffer)) >= 0) { | |
out.write(buffer, 0, count); | |
} | |
in.close(); | |
out.flush(); | |
out.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment