targetDir = targetDir.replace("\\", String.valueOf(File.separatorChar));
targetDir = targetDir.replace("/", String.valueOf(File.separatorChar));
targetDir += FS;
BufferedOutputStream outputStream = null;
ZipOutputStream zipOutputStream = null;
try {
outputStream = new BufferedOutputStream(new FileOutputStream(targetDir + FS + fileNm));
zipOutputStream = new ZipOutputStream(outputStream);
zipOutputStream.setLevel(COMPRESSION_LEVEL);
zipEntry(sourceFile, sourcePath, targetDir, zipOutputStream);
if (ua != null) {
zipOutputStream.putNextEntry(new net.sf.jazzlib.ZipEntry("META-INF" + File.separatorChar));
zipOutputStream.closeEntry();
zipOutputStream.putNextEntry(new net.sf.jazzlib.ZipEntry("META-INF" + File.separatorChar+ "manifest.xml"));
try {
GlobalContext.serialize(ua, zipOutputStream, String.class);
zipOutputStream.closeEntry();
} catch (Exception e) {
//e.printStackTrace();
}
}
zipOutputStream.finish();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (zipOutputStream != null) {
zipOutputStream.close();
}
if (outputStream != null) {
outputStream.close();
}
}