List of usage examples for android.util Base64 decode
public static byte[] decode(byte[] input, int flags)
From source file:Main.java
public static String decodeBase64(String encodeStr, String charset, int flags) throws UnsupportedEncodingException { return new String(Base64.decode(encodeStr, flags), charset); }
From source file:Main.java
/** * Converts from String to byte array//from w w w . java2 s . co m * @param str - The String to be decoded * @return - The returned byte array */ public static byte[] decode(String str) { return Base64.decode(str.getBytes(), Base64.DEFAULT); }
From source file:Main.java
public static Bitmap decodeImageBase64(String bitmapString) { byte[] bytes = Base64.decode(bitmapString.getBytes(), Base64.DEFAULT); return BitmapFactory.decodeByteArray(bytes, 0, bytes.length); }
From source file:Main.java
public static String decryptData(String encryptBase64Data, String keyBase64) { SecretKeySpec key = new SecretKeySpec(Base64.decode(keyBase64, Base64.DEFAULT), "DES"); Cipher decipher = null;//ww w . j a v a2 s.co m try { decipher = Cipher.getInstance("DES"); decipher.init(Cipher.DECRYPT_MODE, key); byte[] encryptData = Base64.decode(encryptBase64Data, Base64.DEFAULT); return new String(decipher.doFinal(encryptData), "UTF8"); } catch (Exception e) { } return null; }
From source file:Main.java
public static byte[] decode(String string) { return Base64.decode(string, Base64.URL_SAFE); }
From source file:Main.java
public static String getFromBase64(String str) { String result = ""; if (str != null) { try {/*from w w w. j a v a2s .c o m*/ result = new String(Base64.decode(str, Base64.NO_WRAP), "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return result; }
From source file:Main.java
public static Bitmap convertBase64ToBitmap(String strBase64) { byte[] imageAsBytes = Base64.decode(strBase64.getBytes(), Base64.DEFAULT); Bitmap result = BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length); return result; }
From source file:Main.java
public static String decodeBase64(String str) throws UnsupportedEncodingException, Base64DataException { return new String(Base64.decode(str, Base64.DEFAULT), "UTF-8"); }
From source file:Main.java
public static byte[] base64UrlDecode(String arg) { return Base64.decode(arg, Base64.URL_SAFE | Base64.NO_WRAP); }
From source file:Main.java
public static Bitmap fromBase64(String base64) { Bitmap bitmap = null;/*from ww w . java 2s . c o m*/ if (base64 != null) { byte[] bytes = Base64.decode(base64, Base64.DEFAULT); if (null != bytes) { bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); } } return bitmap; }