MCPcopy Create free account
hub / github.com/R4gd0ll/LazyAnFuZai / readFile

Method readFile

src/main/java/utils/CheckBase.java:15–41  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

13
14
15 public static String readFile(String path){
16
17// try {
18// FileInputStream in = new FileInputStream(path);
19// int size=in.available();
20// byte[] buffer=new byte[size];
21// in.read(buffer);
22// in.close();
23// return new String(buffer);
24// } catch (Exception e) {
25// e.printStackTrace();
26// }
27 try (FileInputStream fis = new FileInputStream(path);
28 InputStreamReader isr = new InputStreamReader(fis,"gb2312");
29 BufferedReader reader = new BufferedReader(isr)) {
30 String line;
31 String res = "";
32 while ((line = reader.readLine()) != null) {
33 res += line+"\n";
34 }
35 return res;
36 } catch (Exception e) {
37 System.err.println("An error occurred: " + e.getMessage());
38 }
39
40 return null;
41 }
42
43 public static String jiaoben(){
44 String sh = "#!/bin/bash\n" +

Callers 2

chooseFileMethod · 0.95
ConfigInMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected