The Enumeration returned by standard
java.util.zip.ZipFile.entries() walks throuhg a .zip
file's entries in the order they were stored. The
Hashmap used in jazzlib to store the .zip file's
directory makes this a random order. While this isn't
against specifications, it IS unexpected and in some
cases undesired.
I encountered this when using jazzlib to extract
a .zip with 47000 files in 18000 directories. The
natural order (per directory) would have produced a
lot less drive noise I guess.
So for this particular task I made a temporary
modification to the ZipFile.readEntries() method,
storing every ZipEntry retrieved from the .zip's
directory in an array as well:
ZipEntries[] array = new ZipEntry[count];
...
for (i = 0; i < count; i++)
{
...
entries.put(name, entry);
array[i] = entry;
}
and modified the entries() method to return
getEntries();//assures entries are read from
zipfile directory
return new ZipEntryEnumeration(Arrays.asList
(aze).iterator());
An array isn't heavy, so maybe this patch could be
applied to the 'official' code
Logged In: YES
user_id=639492
Originator: NO
You could probably replace the HashMap with a LinkedHashMap to get the same effect with much less code.