Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

multiple file export as zip file (using DownloadAction class in struts)

 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks, I have a set of files store in db as blob type , and i need to export all these files as zip file using DownloadAction.

I know how to export each file one by one, i just need to override the DownloadAction.StreamInfo inner class, and returns the input stream of blob file,

but what about zip ? can anyone suggest the way to do this? thanks!
 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the solution i saw on the web is about packing existing files as zip.

is there a solution that, i can accepts a set of streams ?
 
Thai C. Tran
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried package java.util.zip ? http://www.exampledepot.com/egs/java.util.zip/CreateZip.html
 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thai C. Tran wrote:Have you tried package java.util.zip ? http://www.exampledepot.com/egs/java.util.zip/CreateZip.html


Hi, thanks for you reply.

I have read the example, but is that means i need to do following:
1. transforms the blob data in the database to a set of files?
2. then packs the files into zip?

is there a way to avoid creating the files, and creates only the zip file
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!