aspose file tools
The moose likes Java in General and the fly likes Problem creating the zip file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem creating the zip file " Watch "Problem creating the zip file " New topic

Problem creating the zip file

Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
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

Joined: Oct 27, 2005
Posts: 19896

What is the return value of,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:

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Problem creating the zip file