小编Dee*_*hry的帖子

ZipInputStream和JarInputStream的ZipEntry大小之间不一致

我在使用ZipInputStream读取并从Applet遍历ZipEntry的zip文件中有一堆图像文件。

   ZipInputStream zis = new ZipInputStream(in);
        ZipEntry ze = null;
        while ((ze = zis.getNextEntry()) != null) {
            htSizes.put(ze.getName(), new Integer((int) ze.getSize()));
            if (ze.isDirectory()) {
                continue;
            }
            int size = (int) ze.getSize();
            // -1 means unknown size.
            if (size == -1) {
                size = ((Integer) htSizes.get(ze.getName())).intValue();
            }
            byte[] b = new byte[(int) size];
            int rb = 0;
            int chunk = 0;
            while (((int) size - rb) > 0) {
                chunk = zis.read(b, rb, (int) size - rb);
                if (chunk == -1) …
Run Code Online (Sandbox Code Playgroud)

java zip applet jar signed-applet

5
推荐指数
1
解决办法
6210
查看次数

标签 统计

applet ×1

jar ×1

java ×1

signed-applet ×1

zip ×1