List of utility methods to do XML Base64 Encode Decode
String | base64Encode(String data) Encode the given string with Base64 return DatatypeConverter.printBase64Binary(data.getBytes("UTF-8")); |
String | base64EncodeBasicCredentials(String username, String password) Base64-encodes the specified username and password for Basic Authorization for HTTP requests or upstream proxy authorization. String credentialsToEncode = username + ':' + password; byte[] credentialsAsUtf8Bytes = credentialsToEncode.getBytes(StandardCharsets.UTF_8); return DatatypeConverter.printBase64Binary(credentialsAsUtf8Bytes); |
String | base64FromBinary(byte[] value) Convert (encode) the given binary value using Base64. return DatatypeConverter.printBase64Binary(value);
|
String | base64FromString(String value) Convert the given String to UTF-8, encode the result with Base64, and return the encoded value as a string. return DatatypeConverter.printBase64Binary(toBytes(value));
|
byte[] | base64ToByte(String data) From a base 64 representation, returns the corresponding byte[] return DatatypeConverter.parseBase64Binary(data);
|
String | byteArrayToBase64String(byte[] data) byte Array To Base String return DatatypeConverter.printBase64Binary(data);
|
String | BytesToBase64String(final byte[] value) Bytes To Base String return DatatypeConverter.printBase64Binary(value);
|
String | byteToBase64(byte[] data) byte To Base return DatatypeConverter.printBase64Binary(data);
|
String | compressToBase64(byte[] message) compress To Base return DatatypeConverter.printBase64Binary(compress(message));
|
String | createBase64EncodedStringFromURL(URL url) create Base Encoded String From URL final InputStream inputStream = url.openStream(); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); outputStream.close(); ... |