MLi
8/26/2016 - 5:43 PM

convertFileToBase64.java

public void convertFileToBase64() {
    String path = this.getClass().getClassLoader().getResource("10012312135.pfx").getPath();
    try {
      byte[] b = Files.toByteArray(new File(path));
      System.out.println(Base64.encodeBase64String(b));
    } catch (IOException e) {
      e.printStackTrace();
    }
}