public int zipUncompress(String inputFile, String destDirPath) {
String[] cmd = new String[] { "unzip", inputFile, "-d", destDirPath };
Process ps;
int ret = -1;
try {
ps = Runtime.getRuntime().exec(cmd);
ret = ps.waitFor();
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = br.readLine()) != null) {
sb.append(line).append("\n");
}
String result = sb.toString();
LogUtils.processLog(result);
} catch (IOException | InterruptedException e) {
LogUtils.errorLog(ExceptionUtils.getStackTrace(e));
ret = -1;
}
return ret;
}
Java 调用Linux 解压zip
最新推荐文章于 2022-12-14 16:29:25 发布
1万+

被折叠的 条评论
为什么被折叠?



