Java XML Base64 Encode Decode decodeBase64(File file)

Here you can find the source of decodeBase64(File file)

Description

decode Base

License

Open Source License

Declaration

public static String decodeBase64(File file) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.xml.bind.DatatypeConverter;
import java.io.*;

public class Main {
    public static String decodeBase64(File file) {
        FileInputStream fis = null;
        try {//from  ww  w.  jav a 2s  .c o m
            fis = new FileInputStream(file);
            byte[] imageBytes = new byte[(int) file.length()];
            fis.read(imageBytes);
            fis.close();
            return DatatypeConverter.printBase64Binary(imageBytes);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. BytesToBase64String(final byte[] value)
  2. byteToBase64(byte[] data)
  3. compressToBase64(byte[] message)
  4. createBase64EncodedStringFromURL(URL url)
  5. decode(String base64)
  6. decodeBase64(String b64data)
  7. decodeBase64(String base64)
  8. decodeBase64(String s)
  9. decodeBase64(String value)