Example usage for android.util Base64 decode

List of usage examples for android.util Base64 decode

Introduction

In this page you can find the example usage for android.util Base64 decode.

Prototype

public static byte[] decode(byte[] input, int flags) 

Source Link

Document

Decode the Base64-encoded data in input and return the data in a new byte array.

Usage

From source file:Main.java

private static byte[] fromBase64(String src) {
    return Base64.decode(src, Base64.NO_WRAP);
}

From source file:Main.java

public static byte[] getBitmapBytes(String base64) {
    return Base64.decode(base64.getBytes(), 5);
}

From source file:Main.java

public static byte[] decodeBase64FromUrlSafe(String content) {
    int flags = Base64.URL_SAFE;
    return Base64.decode(content, flags);
}

From source file:Main.java

/***
 * decode by Base64/*from   www.j a  va 2  s .  c o  m*/
 */
public static byte[] decodeBase64(byte[] input) throws Exception {
    return Base64.decode(input, Base64.DEFAULT);
}

From source file:Main.java

public static String decodeByBase64(String string) {
    byte[] decode = Base64.decode(string, Base64.DEFAULT);
    String result = new String(decode);

    return result;
}

From source file:Main.java

public static byte[] decode(String base64) throws Exception {
    //return Base64.decode(base64.getBytes());
    return Base64.decode(base64, Base64.DEFAULT);
}

From source file:Main.java

public static String getFromBase64(String strBase64) {
    byte[] b64 = strBase64.getBytes();
    String result = new String(Base64.decode(b64, Base64.DEFAULT));
    return result;
}

From source file:Main.java

public static String decodeString(String base64String) {
    byte[] data = Base64.decode(base64String, Base64.DEFAULT);
    String text = null;//w ww  . jav  a  2 s.  c o  m
    try {
        text = new String(data, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return text;
}

From source file:Main.java

public static String decode(String s) {
    if (s == null)
        return null;
    try {/* w  w w  . ja  va  2 s  .  c o  m*/
        return new String(Base64.decode(s, Base64.DEFAULT));
    } catch (Exception e) {
        return null;
    }
}

From source file:Main.java

public static String decodeBase64(String encodedString) {

    byte[] byteData = Base64.decode(encodedString, Base64.NO_WRAP);
    String decodedString = null;//from  w w w.  j  ava2s . c  o  m
    try {
        decodedString = new String(byteData, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return decodedString;
}