in src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java [157:176]
protected CryptoInputStream(final Input input, final CryptoCipher cipher, final int bufferSize,
final Key key, final AlgorithmParameterSpec params) throws IOException {
this.input = input;
this.cipher = cipher;
this.bufferSize = checkBufferSize(cipher, bufferSize);
this.key = key;
this.params = params;
if (!(params instanceof IvParameterSpec)) {
// other AlgorithmParameterSpec such as GCMParameterSpec is not
// supported now.
throw new IOException("Illegal parameters");
}
inBuffer = ByteBuffer.allocateDirect(this.bufferSize);
outBuffer = ByteBuffer.allocateDirect(this.bufferSize + cipher.getBlockSize());
outBuffer.limit(0);
initCipher();
}