private void extractZipFile(InputStream inputStream) {
try (ZipInputStream zis = new ZipInputStream(inputStream, Charset.forName("GBK"))) {
// 解析文件
ZipEntry entry = zis.getNextEntry();
while (entry != null) {
// 是文件的话就跳过
if (entry.isDirectory()) {
entry = zis.getNextEntry();
continue;
}
// 获取文件名
String fileName = entry.getName();
byte[] bytes = IOUtils.toByteArray(zis);
if (bytes.length <= 0) {
entry = zis.getNextEntry();
continue;
}
entry = zis.getNextEntry();
// TODO 进行文件写操作
}
} catch (Exception e) {
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
}
}
return;
}