Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #encode #file #java
ADD COMMENT
Topic
Name
8+6 =