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

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

From source file:Main.java

private static final String decodeBase64String(String string) {
    return new String(Base64.decode(string, Base64.DEFAULT));
}

From source file:Main.java

public static byte[] base64Decrypt(String paramString) {
    byte[] arrayOfByte = Base64.decode(paramString, 0);
    if ((arrayOfByte == null) || (arrayOfByte.length == 0))
        arrayOfByte = paramString.getBytes();
    return arrayOfByte;
}

From source file:Main.java

public static String decodeBASE64(String key) throws Exception {
    byte[] data = Base64.decode(key.getBytes(), Base64.DEFAULT);
    String str = String.valueOf(data);
    return str;/*www. j a  v a 2 s  .  c  o  m*/
}

From source file:Main.java

public static String decode(String str) {
    try {//  w w  w.  j av  a 2 s. com
        byte[] result = Base64.decode(str, Base64.DEFAULT);
        return new String(result);
    } catch (Exception e) {
        return str;
    }
}

From source file:Main.java

public static byte[] base64ToByte(String base64Str) {
    try {//w  w  w .  java 2 s .  co  m
        return Base64.decode(base64Str, Base64.DEFAULT);
    } catch (Exception e) {
        // TODO: handle exception
    }
    return new byte[0];
}

From source file:Main.java

public static String decodeBase64String(String str) {
    try {//from   w  ww  .  j  a v a 2  s .  c om
        return new String(Base64.decode(str, Base64.DEFAULT));
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:Main.java

public static byte[] base64Decode(byte[] input) {
    return Base64.decode(input, Base64.DEFAULT);
}

From source file:Main.java

public static byte[] decode(byte[] bytes) {
    return Base64.decode(bytes, Base64.URL_SAFE);
}

From source file:Main.java

public static byte[] encodedStringToBytes(String encoded) {
    return Base64.decode(encoded, Base64.NO_WRAP);
}