The comments for all files are stored in the index structure at the
end of the stream, so there's no way to retrieve them until the end
of the stream is reached. The zip file format just isn't that well
suited to stream processing.
Having said that, it would be possible for Sun to handle this under
the existing API. Basically, whenever ZipInputStream returns a
ZipEntry, hold onto a weak reference to it. When it gets to the end
of the stream, read all the comments and set them in the
corresponding ZipEntry (if it is still strongly referenced). So when
you first read the ZipEntry, the comments will be null, but if you
hold onto the ZipEntrys until the stream has been completely read,
the comments would then be available.
I'd go submit a patch to Mustang, but as everyone is very aware, it
doesn't work under OS X. Grrr.
On Jan 3, 2006, at 6:31 AM, Geoff Levner wrote:
To answer my own question, I found this in Sun's bug database:
Unfortunately the bug is "not a bug", and so presumably will never
be fixed...
Has anybody out there ever successfully used ZipInputStream (or
JarInputStream) to read the comments associated with each Zip
entry in a zip file? When I use ZipFile I have no problem, but
when I use ZipInputStream, the entries' comments are always null.
Attachment:
PGP.sig Description: This is a digitally signed message part
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden