• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Zip docx dir structure - missing bytes?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I would like to zip a docx directory structure.
Here's the code:



Then I write to a file the given byte array :



When I try open myDocx.docx ('a' file) I give an IO error.
If I zip the c:\Temp\DOCX_uncomp_source_dir directory content to a zip and rename to docx ('b' file), it works perfectly. I can open it.
I compare 'a' and 'b' docx content. It's ok. The number of files and (inside files) size too (! it seems) perfectly match! (I used total commander.)
But if a compare 'a' and 'b' docx file size: the 'a' file size is smaller than 'b'. (The differece is 300 bytes.)

What do I miss? What do I do wrong? Any idea?

(Sorry my bad english.)
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should not the zos.closeEntry() be inside the for loop?

P.S. Loading the whole document into a byte array does not scale well and is not required; just use streams.
 
Peter Varsanyi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, yes I have saw that, I have tried zos.closeEntry() be inside the for loop, but nothing changed.
 
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic