当前位置:   article > 正文

java 导出加密压缩包 设置 压缩包加密密码 并下载 (springboot+文件工具类)_java导出zip加密

java导出zip加密

我们现在要下载一个压缩包文件 并设置密码,密码统一固定
后台部分:



    @Value("${drap_platform.export_password}")
    private String exportPassword;



@Override
    public void createZip(List<TmsTemplate> list,HttpServletResponse response,HttpServletRequest request) throws IOException {
   

        // 数据准备
        JSONObject jsonObject = new JSONObject();
        String jsonStr = jsonObject.toJSONString(list, SerializerFeature.WriteDateUseDateFormat);
        logger.debug("createZip json: {}" , jsonStr);
        String currTime =DateUtils.dateTimeNow();
        String folder = "template_" + currTime;
        // 将json数组写入 template_export.json
        //  String dirName = tarPath + "File.separator" + folder + File.separator;
        String dirName = tarPath + File.separator + folder + File.separator;
        logger.debug("要操作的文件夹: {}" , dirName);

        boolean exist = FileUtil.exist(dirName);
        if (exist) {
   
            FileUtil.del(dirName);
        }
        File jsonFile = FileUtil.file(dirName + "template_export.json"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/984655
推荐阅读
相关标签
  

闽ICP备14008679号