读取文件信息

 1 /**
 2      * 读取文件信息
 3      * @param src  文件路径
 4      * @return String
 5      */
 6     public static String readCacert(String src) {
 7         StringBuilder sb = new StringBuilder();
 8         try {
 9             BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(src))));
10             String CacertStr = null;
11             while (null != (CacertStr = br.readLine())) {
12                 sb.append(CacertStr);
13             }
14             br.close();
15         } catch (Exception e) {
16             e.printStackTrace();
17         }
18         return sb.toString();
19     }

 

posted @ 2017-12-13 17:31  林**  阅读(196)  评论(0编辑  收藏  举报