Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ZipInputStream does not read comments



On 05/01/2006, at 19:51, Nicholas Rinard wrote:

how is this not a bug?

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:

   http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4201267

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.

-- Lachlan O'Dea CA Senior Software Engineer tel: +61 3 8416 5627 fax: +61 3 8416 5810 mobile: +61 412 390 650 email@hidden

Relax and enjoy your shoes!



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

References: 
 >ZipInputStream does not read comments (From: Geoff Levner <email@hidden>)
 >Re: ZipInputStream does not read comments (From: Geoff Levner <email@hidden>)
 >Re: ZipInputStream does not read comments (From: Nicholas Rinard <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.