encode file to base64 java
private static String encodeFileToBase64Binary(String fileName) throws IOException { File file = new File(fileName); byte[] encoded = Base64.encodeBase64(FileUtils.readFileToByteArray(file)); return new String(encoded, StandardCharsets.US_ASCII); }