/** * Gets CryptoCipher from pool. * * @return the CipherState instance. * @throws IOException if an I/O error occurs. */ private CipherState getCipherState() throws IOException { CipherState state = cipherPool.poll(); if (state == null) { CryptoCipher cryptoCipher; try { cryptoCipher = CryptoCipherFactory.getCryptoCipher("AES/CTR/NoPadding", props); } catch (GeneralSecurityException e) { throw new IOException(e); } state = new CipherState(cryptoCipher); } return state; }