MCPcopy Index your code
hub / github.com/razerdp/BasePopup / readFile

Method readFile

app/src/main/java/razerdp/demo/utils/FileUtil.java:57–73  ·  view source on GitHub ↗
(String filePath)

Source from the content-addressed store, hash-verified

55 }
56
57 public static String readFile(String filePath) {
58 String result = "";
59 try {
60 FileInputStream fileInputStream = new FileInputStream(filePath);
61 int length = fileInputStream.available();
62 byte[] buffered = new byte[length];
63 fileInputStream.read(buffered);
64
65 result = new String(buffered, Charset.defaultCharset());
66
67 fileInputStream.close();
68 } catch (Exception e) {
69 e.printStackTrace();
70 }
71 return result;
72
73 }
74
75 public static String getFileName(String path) {
76 if (TextUtils.isEmpty(path)) return null;

Callers 1

initMethod · 0.95

Calls 2

readMethod · 0.80
closeMethod · 0.45

Tested by 1

initMethod · 0.76