1 changed files with 30 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||
package cn.chjyj.szwh.utils; |
|||
|
|||
import java.io.*; |
|||
|
|||
/** |
|||
* 文件操作工具 |
|||
* xy |
|||
*/ |
|||
public class SzFileUtils { |
|||
/** |
|||
* 读取pem文件信息内容,并返回字符串 |
|||
* |
|||
* @param filePath |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static String getKeyFromFile(String filePath) throws Exception { |
|||
File file = new File(filePath); |
|||
InputStream ins = new FileInputStream(file); |
|||
BufferedReader br = new BufferedReader(new InputStreamReader(ins)); |
|||
String readLine = null; |
|||
StringBuffer sb = new StringBuffer(); |
|||
while ((readLine = br.readLine()) != null) { |
|||
sb.append(readLine); |
|||
} |
|||
br.close(); |
|||
ins.close(); |
|||
return new String(sb); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue