if (!entryName.isEmpty()) {
if (entry.isDirectory()) {
File dir = new File(directory, entryName);
if (!dir.exists()) {
if (!new File(directory, entryName).mkdir()) {
throw new PlatformManagerException("Failed to create directory");
}
}
} else {
int count;
byte[] buffer = new byte[BUFFER_SIZE];
BufferedOutputStream out = null;
try {
OutputStream os = new FileOutputStream(new File(directory, entryName));
out = new BufferedOutputStream(os, BUFFER_SIZE);
while ((count = zin.read(buffer, 0, BUFFER_SIZE)) != -1) {
out.write(buffer, 0, count);
}
out.flush();
} finally {
if (out != null) {
out.close();
}
}
}
}
}
} catch (Exception e) {
throw new PlatformManagerException("Failed to unzip module", e);
} finally {
if (deleteZip) {
zipFile.delete();
}
}