0

既存のファイル (xml) を取得して、zip ディレクトリに配置しようとしています。私が遭遇している問題は、xml ファイルが現在存在しているディレクトリも zip に書き込まれることです。誰もこれについて考えていますか?

  byte[] buffer = new byte[1024];

            FileOutputStream fos = new FileOutputStream(loc + "/dir" + endFileExt+".kmz");
            ZipOutputStream zos = new ZipOutputStream(fos);

            ZipEntry ze = new ZipEntry(loc + "/dir" + endFileExt+".xml");
            zos.putNextEntry(ze);
            FileInputStream in = new FileInputStream(loc + "/dir" + endFileExt+".xml");
            int len;
            while ((len = in .read(buffer)) > 0) {
                zos.write(buffer, 0, len);
            }

            in.close();
            zos.closeEntry();
            zos.close();
4

0 に答える 0