1、将前端上传的html文件全部读取出来,并用string字符串返回出去解析的内容

 public static String openFile(MultipartFile file) {
        try {
            BufferedReader bis = new BufferedReader(new InputStreamReader(file.getInputStream()));
            StringBuilder szContent = new StringBuilder();
            String szTemp;

            while ((szTemp = bis.readLine()) != null) {
                szContent.append(szTemp);
            }
            bis.close();
            return szContent.toString();
        } catch (Exception e) {
            logger.error("open file fail ===》", e);
            return "";
        }
    }

 

相关文章:

  • 2021-05-18
  • 2022-02-07
  • 2022-01-18
  • 2022-02-09
  • 2021-09-05
  • 2021-11-23
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2022-01-01
相关资源
相似解决方案