ut there appears to be no methods in
ZipFile to modify/update an xml file within an existing jar file with an
OutputStream. What other solutions are there?
See the code at
http://mindprod.com/jgloss/zip.html
You can certainly add a new entry. So perhaps the way you are supposed
to do it is by deleting the old entry and writing a new one.
On my curiosity list is to discover how clever java is about writing
zips.. In the worst scenario, every time you update an element it
would rewrite the whole file, or collapse and created hole in place.
If it were smart it could just tack on the end, and when you did the
file close, it could copy the whole thing to a new file, leaving out
the holes. In the happy case there were no holes, it could bypass the
final copy/rename.
Anyone old enough to remember IBM 360 and the endless in-place
compressing of partitioned datasets, shaking the drives? Univac byte
machines had the same problem. I wrote a compressor that found another
physical drive to copy to, leaving the holes behind, then copied
back. It was much faster and put less wear on the drives, since
neither head had to move more than a track at a time.
I have wondered how long until we get high performance drives with
multiple sets of arms then a smart algorithm in the drive reduce head
motions. Their existence could be transparent to the OS, though the
system might work better if the two co-operated.
Similarly, I still have not seen any marthaing hard drives. I proposed
this idea way back in the early 80s. See
http://mindprod.com/jgloss/martha.html