I wanted to download an excel file. But for the download I need an InputStream, but I have an OutPutStream. By convertig output to input i got several exceptions.
Code: Select all
File tempFile = File.createTempFile("tempFile", ".xslx");
OutputStream out = new FileOutputStream(tempFile);
createFile.writeReport(out);
out.close();
InputStream istream = new FileInputStream(tempFile);
setFile(new DefaultStreamedContent(istream, "application/vnd.ms-excel", "file.xslx"));
istream.close();
tempFile.delete();
thank you in advance!
trap12