Android Utililty Methods Base64 Encode

List of utility methods to do Base64 Encode

Description

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

Method

StringencodeBase64(String value)
encode Base
if (!isEmpty(value)) {
    return Base64.encodeToString(value.getBytes(), Base64.DEFAULT);
return "";
Stringencode(String s)
encode
return encode(s.getBytes());
byte[]encode(final String str)
encode
return Base64.encode(str.getBytes(), Base64.DEFAULT);
Stringencode(String source)
Returns the base 64 encoded equivalent of a supplied string.
char[] sourceBytes = getPaddedBytes(source);
int numGroups = (sourceBytes.length + 2) / 3;
char[] targetBytes = new char[4];
char[] target = new char[4 * numGroups];
for (int group = 0; group < numGroups; group++) {
    convert3To4(sourceBytes, group * 3, targetBytes);
    for (int i = 0; i < targetBytes.length; i++) {
        target[i + 4 * group] = encodingChar.charAt(targetBytes[i]);
...
Stringencode(String str)
encode
byte[] encode = Base64.encode(str.getBytes(), Base64.DEFAULT);
return new String(encode);
StringencodedBase64(String currentString)
encoded Base
byte[] commentData = null;
try {
    commentData = currentString.trim().getBytes("UTF-8");
} catch (UnsupportedEncodingException e1) {
    e1.printStackTrace();
String b = Base64.encodeToString(commentData, Base64.NO_WRAP);
return b;
...
StringtoBase64(String value)
Converts value to base64.
return toBase64(value.getBytes());
StringtoBase64(byte[] bytes)
Converts bytes to base64.
return new String(android.util.Base64.encode(bytes,
        android.util.Base64.DEFAULT));
Stringbase64Encode(byte[] bytes)
base Encode
return Base64.encodeToString(bytes, Base64.DEFAULT);
Stringbase64Digest(String input)
First encrypt with SHA1 then convert to Base64
String b64digest = convertToBase64(dataDigest(input));
return b64digest.substring(0, b64digest.length() - 1);