Example usage for android.util Base64 DEFAULT

List of usage examples for android.util Base64 DEFAULT

Introduction

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

Prototype

int DEFAULT

To view the source code for android.util Base64 DEFAULT.

Click Source Link

Document

Default values for encoder/decoder flags.

Usage

From source file:Main.java

/***
 * decode by Base64/*from w  w w  .  jav a2 s.  co 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 String bytesToString(byte[] bts) {
    String bmpStr = "";
    try {//from ww  w .  ja va  2 s.  c  o m
        bmpStr = Base64.encodeToString(bts, Base64.DEFAULT);
    } catch (Exception e) {
        // TODO: handle exception
    }
    return bmpStr;
}

From source file:Main.java

public static String encodeBASE64(String s) {
    if (s == null)
        return null;
    return new String(Base64.encode(s.getBytes(), Base64.DEFAULT));
}

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 encodeByBase64(String string) {
    byte[] encode = Base64.encode(string.getBytes(), Base64.DEFAULT);
    String result = new String(encode);

    return result;
}

From source file:Main.java

public static String decode(String s) {
    if (s == null)
        return null;
    try {//ww  w .  ja va2s.  co  m
        return new String(Base64.decode(s, Base64.DEFAULT));
    } catch (Exception e) {
        return null;
    }
}

From source file:Main.java

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

From source file:Main.java

public static Bitmap base64ToBitmap(String base64) {
    byte[] bytes = Base64.decode(base64, Base64.DEFAULT);
    return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}