• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generate a file, then zip it for downloading

 
Daoyue Ming
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now i have a problem with zip a outputstream.

more info here: i generate a file on the fly in the web server, and the result is an OutputStream Object. However, when I try to zip the object, I can't find a way to write the contents from OutputStream Object into the ZipOutputStream. I know if write the OutputStream Object as a file in the web server, then it can solve it, but I try to avoid writting file in web server.

Is there any way out?
 
Harald Kirsch
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't write into the OutputStream. Use

ZipOutputStream zip = new ZipOutputStream(your_outputstream_here)

and the write into the zip.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!