• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem creating the zip file

 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

This is the code I am using to create a zip file with a pdf file.
The same code works fine when I create a zip file with a doc file.
When I open the pdf in the zip file, it says it is corrupted or damaged and cannot be opened.

 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the return value of fis.read(buf,0,buf.length)? Just because you try to read it all at once, don't assume that will succeed. You should always read data in a loop, and use the return value to determine what to write:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic