Java Utililty Methods XML Base64 Encode Decode

List of utility methods to do XML Base64 Encode Decode

Description

The list of methods to do XML Base64 Encode Decode are organized into topic(s).

Method

byte[]decode(String base64)
Decode the given Base64 String to a byte array
return DatatypeConverter.parseBase64Binary(base64);
StringdecodeBase64(File file)
decode Base
FileInputStream fis = null;
try {
    fis = new FileInputStream(file);
    byte[] imageBytes = new byte[(int) file.length()];
    fis.read(imageBytes);
    fis.close();
    return DatatypeConverter.printBase64Binary(imageBytes);
} catch (FileNotFoundException e) {
...
byte[]decodeBase64(String b64data)
Convert a Base64-encoded String into an array of bytes.
return DatatypeConverter.parseBase64Binary(b64data);
byte[]decodeBase64(String base64)
decode Base
if (base64 == null || base64.equals("")) {
    return null;
try {
    return DatatypeConverter.parseBase64Binary(base64);
} catch (Exception e) {
    return null;
byte[]decodeBase64(String s)
* Decode the given base64 String * @param s Holds the base64 encoded bytes
return javax.xml.bind.DatatypeConverter.parseBase64Binary(s);
byte[]decodeBase64(String value)
decode Base
return DatatypeConverter.parseBase64Binary(value);
byte[]decompressFromBase64(String message)
decompress From Base
byte[] compressed = DatatypeConverter.parseBase64Binary(message);
if (!isGzipped(compressed)) {
    return null;
return decompress(compressed);
StringencodeBase64(byte[] b)
_more_
return javax.xml.bind.DatatypeConverter.printBase64Binary(b);
StringencodeBase64(byte[] bytes)
Convert a byte array into a Base64-encoded String.
return DatatypeConverter.printBase64Binary(bytes);
StringencodeBASE64(byte[] data)
Encode the input bytes into BASE64 format.
return DatatypeConverter.printBase64Binary(data);