提交 753c2706 authored 作者: 任建彩's avatar 任建彩

feat:打包文件名

1.file
上级 cf266edc
......@@ -51,7 +51,9 @@ public class ZipUtil {
for (FileInfo file : list) {
String filePath = rootPath + file.getPath() + "/" + file.getFileName() + file.getSuffixName();
File sourceFile = new File(filePath);
compress(out, sourceFile, sourceFile.getName());
String fileName=file.getOriginalFileName() + file.getSuffixName();
//compress(out, sourceFile, sourceFile.getName());
compress(out, sourceFile, fileName);
}
out.close();
......@@ -68,7 +70,9 @@ public class ZipUtil {
for (FileInfo file : list) {
String filePath = rootPath + file.getPath() + "/" + file.getFileName() + file.getSuffixName();
File sourceFile = new File(filePath);
compress(out, sourceFile, sourceFile.getName());
String fileName=file.getOriginalFileName() + file.getSuffixName();
//compress(out, sourceFile, sourceFile.getName());
compress(out, sourceFile, fileName);
}
out.close();
......@@ -90,6 +94,7 @@ public class ZipUtil {
}
}
} else {// 如果不是目录(文件夹),即为文件,则先写入目录进入点,之后将文件写入zip文件中
out.putNextEntry(new ZipEntry(base));
FileInputStream fos = new FileInputStream(sourceFile);
BufferedInputStream bis = new BufferedInputStream(fos);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论