List of usage examples for android.util Base64 decode
public static byte[] decode(byte[] input, int flags)
From source file:Main.java
/** * Metodo che decifra la password proveniente dalla sorgente dati * @param string = password in Base64/*from ww w . j av a 2 s . c o m*/ * @return password in chiaro */ public static String decodePassword(String string) { byte[] data = Base64.decode(string, Base64.DEFAULT); return new String(data); }
From source file:Main.java
public static Bitmap stringToBitmap(String string) { Bitmap bitmap = null;/* w w w. j a v a 2s. c o m*/ try { byte[] bitmapArray; bitmapArray = Base64.decode(string, Base64.DEFAULT); bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length); } catch (Exception e) { e.printStackTrace(); } return bitmap; }
From source file:Main.java
public static Bitmap getBitmap(Context context, String str) { if (str != null && str.length() > 0) { byte[] decode = Base64.decode(str, Base64.DEFAULT); return BitmapFactory.decodeByteArray(decode, 0, decode.length); }/*from ww w .j ava2s . c o m*/ return null; }
From source file:Main.java
public static Bitmap convertStringToBitmap(String string) { Bitmap bitmap = null;/*from w w w . j a v a2 s .c o m*/ try { byte[] bitmapArray; bitmapArray = Base64.decode(string, Base64.DEFAULT); bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length); } catch (Exception e) { e.printStackTrace(); } return bitmap; }
From source file:Main.java
public static Bitmap convertStringToIcon(String st) { Bitmap bitmap = null;// w w w.j a v a 2s.c om try { byte[] bitmapArray; bitmapArray = Base64.decode(st, Base64.DEFAULT); bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length); return bitmap; } catch (Exception e) { return null; } }
From source file:Main.java
/** * Decodes base64 string to original// w w w . j a v a2s . c o m * * @param base64 Base64 string * @return Original string */ public static String fromBase64(String base64) { byte[] data = Base64.decode(base64, Base64.DEFAULT); String origin = new String(data); return origin; }
From source file:Main.java
public static String decode(String str, int time) { System.out.println(str);// ww w . ja v a 2s .c o m String result = new String(str); for (int i = 0; i < time; i++) { System.out.println("i : " + i); byte[] decode = Base64.decode(result.getBytes(), Base64.NO_WRAP); result = new String(decode); } return result; }
From source file:Main.java
public static Bitmap deserialize(String bitmapBase64) { byte[] byteArray = Base64.decode(bitmapBase64, BASE64_FLAGS); Bitmap poster = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length); return poster; }
From source file:Main.java
/** Read the object from Base64 string. */ public static Object fromString(String s) throws IOException, ClassNotFoundException { byte[] data = Base64.decode(s, 0); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data)); Object o = ois.readObject();/*from w w w.j a v a 2 s .c o m*/ ois.close(); return o; }
From source file:Main.java
/** * decode from a base64 to a bitmap/*w w w . ja v a 2 s. c om*/ * * @param base64 * @return */ public static Bitmap decodeFromBase64(String base64) { byte[] bitmapArray = Base64.decode(base64, Base64.NO_WRAP | Base64.URL_SAFE); return BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length); }