批量压缩文件
public static byte[] zipFiles(List<File> listfiles) throws IOException {
byte[] buf = new byte[1024];
ByteArrayOutputStream outPut = new ByteArrayOutputStream();
ZipOutputStream out = new ZipOutputStream(outPut);
List<String> nameList = new ArrayList<>();
for (File file : listfiles) {
InputStream input = new ByteArrayInputStream(file.getContent());
if (nameList.size() > 0 && CommonUtil.existsStrList(nameList, file.getFileName())) {
out.putNextEntry(new ZipEntry(CommonUtil.returnChangeFileName(file.getFileName(), nameList.size())));
} else {
nameList.add(file.getFileName());
out.putNextEntry(new ZipEntry(file.getFileName()));
}
int len;
while ((len = input.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.closeEntry();
input.close();
}
out.close();
return outPut.toByteArray();
} public static byte[] zipF