downloadInterviewFile() throws Exception { // 根据面试官主键编码 下载文件 ..._responseentity批量下载">
当前位置:   article > 正文

SpringBoot学习之用ResponseEntity批量下载压缩文件(五)

responseentity批量下载

我看了很多网上的demo,先生成ZIP压缩文件,然后再下载。我这里是生成ZIP文件流 进行下载。(核心代码没多少,就是一些业务代码)

  1. @RequestMapping(value = "/")
  2. public ResponseEntity<byte[]> downloadInterviewFile() throws Exception {
  3. // 根据面试官主键编码 下载文件
  4. List<InterviewFile> interviewFiles = this.interviewFileService.getAll(interviewfile);
  5. ByteArrayOutputStream byteOutPutStream = null;
  6. if (!interviewFiles.isEmpty()) {
  7. //单个文件名称
  8. String interviewFileName = "";
  9. //文件后缀
  10. String fileNameSuffix = "";
  11. //创建一个集合用于 压缩打包的参数
  12. List<Map<String, String>> parms = new ArrayList<>();
  13. //创建一个map集合
  14. Map<String, String> fileMaps =null;
  15. //得到存储文件盘符 例 D:
  16. String root = properties.getValue(&#
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/480492
推荐阅读
相关标签
  

闽ICP备14008679号