Description
BlockedOutputStream.java
public BlockedOutputStream(OutputStream out, int blockSize, int bufferSize) { if (bufferSize <= 0) throw new IllegalArgumentException("bufferSize must be greater than 0."); if (out instanceof DataOutputStream) this.out = (DataOutputStream) out; else this.out = new DataOutputStream(out); this.blockSize = blockSize; int remainder = bufferSize % blockSize; if (remainder != 0) remainder = blockSize - remainder; // some buffer space + bytes to make the buffer evened up with the cipher block size - 4 bytes for the size int bb = ByteBuffer.allocate(bufferSize + remainder - 4); }
If the Cipher is not a block cipher, blocksize is zero and would result in a division by zero error.