程序一直是运行好的,突然在另一台服务器上部署,发现不能解压文件, java.util.zip.ZipException:error in opening zip file
程序代码如下:
public static void unzip(String sourceZip, String outputPath) throws Exception {
if (sourceZip == null || outputPath == null) {
return;
}
ZipInputStream in = new ZipInputStream(new FileInputStream(sourceZip));
ZipEntry zipEntry = null;
while ((zipEntry = in.getNextEntry()) != null) {
File dir = new File(outputPath);
dir.mkdir();
File fil = new File(dir, zipEntry.getName());
FileOutputStream out = new FileOutputStream(fil);
int m = -1;
byte[] buffer = new byte[bufferSize];
while ((m = in.read(buffer, 0, 100)) != -1) {
out.write(buffer, 0, m);
}
out.close();
}
in.clo
最后
以上就是敏感流沙最近收集整理的关于java解压zip异常_zip 文件解压缩问题解决 java.util.zip.ZipException:error in opening zip file | 学步园...的全部内容,更多相关java解压zip异常_zip内容请搜索靠谱客的其他文章。
发表评论 取消回复