I have a zip file embedded in my jar and want to read the uncompressed size. My current way of doing this:
ZipFile zipFile = new ZipFile(new File(this.getClass().getClassLoader().getResource("files.zip").toURI()));
Enumeration<? extends ZipEntry> e = zipFile.entries();
long installedSize = 0;
while (e.hasMoreElements()) {
ZipEntry entry = e.nextElement();
installedSize += entry.getSize();
}
This is of course rather dirty and also doesn't work when I embed my jar file into an exe file using JSmooth.
Is there a better way of doing this (without copying the zip file)?