MCPcopy Create free account
hub / github.com/diyhi/bbs / readFileToString

Method readFileToString

src/main/java/cms/utils/FileUtil.java:96–112  ·  view source on GitHub ↗

读文件 @param path 路径 @param encoding 编码 UTF-8 @return 文本字符串

(String path,String encoding)

Source from the content-addressed store, hash-verified

94 * @return 文本字符串
95 */
96 public static String readFileToString(String path,String encoding){
97
98 try {
99 File file = new File(PathUtil.defaultExternalDirectory()+File.separator+path);
100 if(file.exists()){
101 return FileUtils.readFileToString(file, encoding);
102 }
103
104 } catch (IOException e) {
105 // TODO Auto-generated catch block
106 // e.printStackTrace();
107 if (logger.isErrorEnabled()) {
108 logger.error("读文件",e);
109 }
110 }
111 return null;
112 }
113
114 /**
115 * 读文件(读取的内容不包含UTF-8 BOM标志)

Callers 3

isInstallSystemMethod · 0.95
readOriginalVersionMethod · 0.95
readFileBomToStringMethod · 0.80

Calls 1

Tested by

no test coverage detected