寻找现有文件(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();