I have some general questions regarding the java.util.zip library.
What we basically do is an import and an export of many small components. Previously these c
I measured that just listing the files with ZipInputStream is 8 times slower than with ZipFile.
long t = System.nanoTime();
ZipFile zip = new ZipFile(jarFile);
Enumeration extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements())
{
ZipEntry entry = entries.nextElement();
String filename = entry.getName();
if (!filename.startsWith(JAR_TEXTURE_PATH))
continue;
textureFiles.add(filename);
}
zip.close();
System.out.println((System.nanoTime() - t) / 1e9);
and
long t = System.nanoTime();
ZipInputStream zip = new ZipInputStream(new FileInputStream(jarFile));
ZipEntry entry;
while ((entry = zip.getNextEntry()) != null)
{
String filename = entry.getName();
if (!filename.startsWith(JAR_TEXTURE_PATH))
continue;
textureFiles.add(filename);
}
zip.close();
System.out.println((System.nanoTime() - t) / 1e9);
(Don't run them in the same class. Make two different classes and run them separately)