Forums Register Login

Puzzled in java zip API

+Pie Number of slices to send: Send
The method setComment(String) in java.util.zip.ZipOutputStream can put comment to the zip file that I made, but how can I get back the comment from the zip file? There is no such a method getComment() in the class java.util.zip.ZipInputStream or any other zip classes.

Thank you for your help!
+Pie Number of slices to send: Send
Taking a quick look at the api, I found that the getComment() method you are looking for is in package java.util.zip.ZipEntry
+Pie Number of slices to send: Send
Yes, ZipEntry has setComments and getComments methods, but those are for a particular entry, not for the file as a whole (which is what Haiqiang is asking about).

Looking at the source, it seems that the comments written by ZipOutputStream.setComments do not seem to get read by ZipInputStream - they're part of a file footer, so to speak, that follows the last entry, and which is disregarded upon reading.
+Pie Number of slices to send: Send
So then what's the point of setComment()?
+Pie Number of slices to send: Send
I believe that the comment set by setComment() can be read by some advanced Archiving Softwares like Winzip, but really I don't know how it might be possible to read the comment using the java.util.zip package.
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 903 times.
Similar Threads
jdk 1.5.zip
mySQL not for Win32?
Zip file archive comment with extended ASCII characters
Finding out the version of my Oracle driver
How to download a file in IE?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:43:10.