Looking to take an existing file(xml) and place it in a zip directory. The issue I am encountering is the directories which the xml file are currently residing in are also written to the zip as well. Does anyone have thoughts on this?
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();