This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I'm trying to read the file lists (names, paths, CRC, etc.) for ZIP files that were created with WinZIP and 7ZIP. Many of the archive files are over 4 gigs and many of the files in the archive files are over 4 gigs. The ZipFile and ZipInputStream class in the standard Util library are NOT working.
I've been searching everywhere to try to find an alternative library that properly supports ZIP64 etc. and I just can't believe what I'm seeing! I can't find anything anywhere. Well, except for some .NET library that hase a Java wapper will only work on Win32 OS.
How can there be such a gaping hole in the support of archive files in Java!?!?!
Does anyone know where I can get a GOOD ZIP library for Java? At a minimum I need to be able to reliably read the list of contained files and directories for Archive files greater than 4 gigs and with files inside that are larger than 4 gigs. Ideally, I'd also like support for foreign characters in the file names.
Is there REALLY no support out there?!?!? What the heck are other people doing who need to read these ZIP files from within Java?
I tried the apache libraries and they had all the same problems with large zip files. Also, I eventually found out that part of the problem was non-standard characters in some of the file names in the zip files.
As for using an external application, I'm not sure if this would have work for what I needed or not. I didn't need to actually compress or extract anything. I just needed to get the information for all contained files (names, sizes, cRC codes, etc.) and then process that data. I'm not sure what external programs would have given me this data in a format that would be easy to cycle through.
In the end, someone on the Sun discussion forum suggested that i use the pre-release version of JDK 7 which has support for large zip files and adds support for defining the character set that should be used when processing zip files. This ended up being a viable solution so far.
An interesting issue I found though.... Originally my code used Generics so that I could use the "for(ZipEntry ze ; zipfileList)" kind of code. This had a major problem. Using this structure, the code crashes when you first try to build the List if there is a single file in the collection has a character that can't be converted. I had to use the standard enumeration method method which allowed me to catch errors from unconvertible characters in a given file but still be able to process the other files.