• Post Reply Bookmark Topic Watch Topic
  • New Topic

problems in downloading epub files

 
davinder bains
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

i have written the following code to download epub files



After downloading, epub file is not opening.
It is showing "There are some minor errors in the file"...

same code is working for the pdf files...

Please help me in this
 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

I think the problem is probably your last block of data. What if the file length is not evenly divisible by 4096? You'll read that last block of 2000 bytes (for example), and then still write 4096 bytes to the output stream. Those extra 2096 bytes will be garbage left over from the previous read. Try this instead:



 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That syntax isn't allowed; you'll need to move the declaration of count outside the loop. The rest remains the same though:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!