Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void processFile(Cipher cipher,InputStream inputStream, OutputStream outputStream) throws EmprisException{
- byte[] tempInputBuffer = new byte[1024];
- int len;
- try {
- while ((len = inputStream.read(tempInputBuffer)) != -1) {
- byte[] tempOutputBuffer = cipher.update(tempInputBuffer, 0, len);
- if ( tempOutputBuffer != null ) outputStream.write(tempOutputBuffer);
- }
- byte[] obuf = cipher.doFinal();
- if ( obuf != null ) outputStream.write(obuf);
- }catch (IOException | IllegalBlockSizeException | BadPaddingException e) {
- e.printStackTrace();
- }catch (Exception e) {
- e.printStackTrace();
- }
- }
- java.lang.OutOfMemoryError: Java heap space
- at java.util.Arrays.copyOf(Arrays.java:3236)
- at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
- at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
- at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
- at java.io.OutputStream.write(OutputStream.java:75)
- at com.global.empris.common.CryptographyHelper.processFile(CryptographyHelper.java:49)
- at com.global.empris.common.CryptographyHelper.encryptFile(CryptographyHelper.java:105)
Add Comment
Please, Sign In to add comment