Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Strange problem while creating zip file  RSS feed

 
steveo austin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have this code which generates multiple pdf files and then creates a zip file by creating a ZipOutputStream using the response.getoutputstream().

The files get zipped and everything works fine except for a couple of things.

1.The client gets 2 prompts,one after the other, asking him to open/save/cancel.

2.The file opens up with winzip without any errors but some users have zipcentral or some other software and there it gives an error stating that the end of the file was corrupted but I can still open the file.

heres the code:
Any kind of help would be much appreciated...issue 1 is a major issue coz it works fine with winzip.

Thanks

[ February 02, 2006: Message edited by: steveo austin ]
JCE: added code tags for readability
[ February 02, 2006: Message edited by: Joe Ess ]
 
Jeremy Tartaglia
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have access to a Java compiler right now, or JBuilder, so what is compression method "8"? (We have constant named values for a reason. )

Aside from that, I'm still a bit perplexed by your inner loop code. It seems as though only one element is added to your ArrayList, and internally, you're writing one byte at a time? Why not just do this?



And remove that new byte[18024] since it does nothing as far as I can see. Same with 'int len'. As for the rest, it might have something to do with zos.setMethod(8). Did you mean zos.setLevel(8)?

Sorry if this doesn't help at all. Like I said, I have no access to a compiler right now to test it.
[ February 07, 2006: Message edited by: Jeremy Tartaglia ]
 
steveo austin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Jeremy thanks for replying

about setmethod(8) that sets the compression levels.

I had tried writing directly like you told me (I dont suck that much) but for "some" reason it was'nt working....and this was .... so stuck with it.

I was testing other modules of the same application and found this problem while downloading images as well...strange thing is I get this pop-up twice when I click on open but only once when I click on save...
 
Jeremy Tartaglia
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no other ideas. setMethod(8) == setMethod(ZipOutputStream.DEFLATED), and all the programs I've created which use the java.util.zip package work fine under WinZIP, WinRAR, 7-Zip, TUGZip, and a few other packages.

Maybe the problem is with PdfProcessor?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!