public void encryptStream(InputStream clearInputStream, OutputStream encryptedOutputStream) throws IOException, MissingParameterException {

		byte[] clearBytes = IOUtils.toByteArray(clearInputStream);

		byte[] cipherBytes = encryptionProvider.encrypt(clearBytes);

		//encryptedOutputStream = new ByteArrayOutputStream(1000);

		encryptedOutputStream.write(cipherBytes);

		encryptedOutputStream.flush();
		
		encryptedOutputStream.close();
		
	}
public void encryptStream ( InputStream clearInputStream , OutputStream encryptedOutputStream ) throws IOException , MissingParameterException { byte [ ] clearBytes = IOUtils . toByteArray ( clearInputStream ) ; byte [ ] cipherBytes = encryptionProvider . encrypt ( clearBytes ) ; encryptedOutputStream . write ( cipherBytes ) ; encryptedOutputStream . flush ( ) ; encryptedOutputStream . close ( ) ; }
Encrypt the contents of an input stream and write the encrypted data to
the output stream.

@param clearInputStream
Input stream containing the data to be encrypted.
@param encryptedOutputStream
Output stream which the encrypted data will be written to.
@throws IOException
@throws MissingParameterException