Search
 
SCRIPT & CODE EXAMPLE
 

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);
}
Comment

decode base64 to file java

// Note preferred way of declaring an array variable
byte[] data = Base64.decodeBase64(crntImage);
try (OutputStream stream = new FileOutputStream("c:/decode/abc.bmp")) {
    stream.write(data);
}
Comment

java base64 to file

byte[] data = Base64.decodeBase64(base64Img);
try (OutputStream stream = new FileOutputStream("c:/xxxx/xxxx.xx")) {
    stream.write(data);
}
Comment

PREVIOUS NEXT
Code Example
Java :: loop through number java 
Java :: keytool error: java.lang.Exception: Key pair not generated, alias <demo already exists 
Java :: java intent extras 
Java :: java arraylist remove 
Java :: change status bar text color android programmatically 
Java :: bufferedinputstream 
Java :: java http response code 
Java :: what is var in java 
Java :: convert java to python 
Java :: getsource java 
Java :: java.lang.NullPointerException 
Java :: java create file 
Java :: Java JTextArea text size 
Java :: hashmap in java 
Java :: -3 to string in java 
Java :: java arraylist with double 
Java :: get executable path java 
Java :: swiperefreshlayout 
Java :: Java Create a BufferedWriter 
Java :: how to use string variables with an if statement in java 
Java :: java polymorphism 
Java :: simple for loop 
Java :: reverse loop in java 
Java :: java find duplicate element in list 
Java :: how to create char type with jpa 
Java :: How to merge two sorted arrays in Java? 
Java :: nextint java 
Java :: java do while loop example 
Java :: how to spilt the string with comma in jaav 
Java :: implements java 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =