0
我在我的jar中嵌入了一个压缩文件,并且想要读取未压缩的大小。我现在这样做的方式:解压缩嵌入罐子中的zip压缩文件的大小
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();
}
这当然是比较脏的,也当我嵌入我的jar文件到使用JSmooth一个exe文件不起作用。
有没有更好的方式做到这一点(没有复制zip文件)?