If you got the OutputStream from the response
, you can write the contents of the OutputStream
to the response which will be sent back to the browser . Sample code :
OutputStream outStream = response.getOutputStream();
response..setHeader("Content-Disposition", "attachment; filename=datafile.xls");
response.setContentType("application/vnd.ms-excel");
byte[] buf = new byte[4096];
int len = -1;
while ((len = inStream.read(buf)) != -1) {
outStream.write(buf, 0, len);
}
outStream.flush();
outStream.close();
Read this : Content-Disposition:What are the differences between “inline” and “attachment”?
In your case the method definition is :
public static OutputStream decryptAsStream(InputStream inputStream,
String encryptionKey)
So you can get the OutputStream
from that method as :
OutputStream os = ClassName.decryptAsStream(inputStream,encryptionKey);
And then use the os
.