/***
* 解压文件
* @param UploadDirectory 解压成功后要存放的目录
* @param zipFileName 要解压的文件
* @return
*/
public boolean unZipFile(String UploadDirectory, String zipFileName) {
try {
InputStream in = new BufferedInputStream(new FileInputStream(zipFileName));
ZipInputStream zin = new ZipInputStream(in);
ZipEntry entry = null;
while ((entry = zin.getNextEntry()) != null) {
if (entry.getName().toLowerCase().endsWith(".xml")) {
FileOutputStream output = new FileOutputStream(UploadDirectory + "iof.xml");
byte[] b = new byte[512];
int len = 0;
while ((len = zin.read(b)) != -1) {
output.write(b, 0, len);
}
output.close();
}
}
log.info("===解压文件成功===" + zipFileName);
return true;
} catch (Exception e) {
log.error("===解压文件失败===" + e.getMessage());
return false;
}
}