java 读取文内容(text,html)
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 "";
}
}