Browse Source

密钥文件

master
xyiege 4 years ago
parent
commit
a4e9d72d41
  1. 30
      src/main/java/cn/chjyj/szwh/utils/SzFileUtils.java

30
src/main/java/cn/chjyj/szwh/utils/SzFileUtils.java

@ -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…
Cancel
Save