(String path)
| 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" + |
no outgoing calls
no test coverage detected