Android Utililty Methods Base64 Decode

List of utility methods to do Base64 Decode

Description

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

Method

StringdecoderBase64File(String base64Code, String type)
decoder Base File
String sdStatus = Environment.getExternalStorageState();
if (!sdStatus.equals(Environment.MEDIA_MOUNTED)) {
    Log.i("TestFile",
            "SD card is not avaiable/writeable right now.");
    return "unavailable";
File file = new File("/sdcard/myDoc/");
if (!file.exists()) {
...
voiddecode(String data, OutputStream out)
Decode base64 encoded data.
char[] chars = data.toCharArray();
decode(chars, 0, chars.length, out);
voiddecode(Reader reader, OutputStream out)
Decode base64 encoded data.
char[] chunk = new char[8192];
int read;
while ((read = reader.read(chunk)) > -1) {
    decode(chunk, 0, read, out);
intdecode(char c)
decode
if (c >= 'A' && c <= 'Z')
    return ((int) c) - 65;
else if (c >= 'a' && c <= 'z')
    return ((int) c) - 97 + 26;
else if (c >= '0' && c <= '9')
    return ((int) c) - 48 + 26 + 26;
else
    switch (c) {
...
voiddecode(String s, OutputStream os)
decode
int i = 0;
int len = s.length();
while (true) {
    while (i < len && s.charAt(i) <= ' ')
        i++;
    if (i == len)
        break;
    int tri = (decode(s.charAt(i)) << 18)
...
byte[]decode(char[] arr)
decode
int length = arr.length;
if (length == 0)
    return new byte[0];
int sndx = 0, endx = length - 1;
int pad = arr[endx] == '=' ? (arr[endx - 1] == '=' ? 2 : 1) : 0;
int cnt = endx - sndx + 1;
int sepCnt = length > 76 ? (arr[76] == '\r' ? cnt / 78 : 0) << 1
        : 0;
...
StringtoString(String base64Encoded)
Returns the string value get base64encoded
return new String(toBytes(base64Encoded));
byte[]toBytes(String base64Encoded)
Returns the decoded bytes get the base64encoded
return android.util.Base64.decode(base64Encoded,
        android.util.Base64.DEFAULT);
byte[]base64Decode(String property)
base Decode
return Base64.decode(property, Base64.DEFAULT);
byte[]decode(String src)
decode
return Base64.decode(src, Base64.DEFAULT);