MCPcopy Create free account
hub / github.com/Bit0r/java-util / readFile

Method readFile

src/main/java/util/AddTableField.java:21–32  ·  view source on GitHub ↗

一次性读取全部文件数据 @param strFile

(String strFile)

Source from the content-addressed store, hash-verified

19 * @param strFile
20 */
21 public static void readFile(String strFile) {
22 try {
23 InputStream is = new FileInputStream(strFile);
24 int iAvail = is.available();
25 byte[] bytes = new byte[iAvail];
26 is.read(bytes);
27 log.info("文件内容:\n" + new String(bytes));
28 is.close();
29 } catch (Exception e) {
30 e.printStackTrace();
31 }
32 }
33
34 /**
35 * 按行读取文件

Callers

nothing calls this directly

Calls 1

readMethod · 0.80

Tested by

no test coverage detected