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 base64Decode(String s) { byte[] dataDec = Base64.decode(s, Base64.NO_WRAP); String decodedString = ""; try {//w w w . java 2 s .co m decodedString = new String(dataDec, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } finally { return decodedString; } }
From source file:Main.java
public static byte[] decodeBase64(byte[] data) { if (data == null) { return null; }//from w ww .ja v a2 s . com return Base64.decode(data, Base64.DEFAULT); }
From source file:Main.java
public static String base64Decode(String str, String code) throws UnsupportedEncodingException { String string = new String(Base64.decode(str.getBytes(code), Base64.DEFAULT)); return string; }
From source file:Main.java
public static Bitmap getBitmapFromStream(String stream) throws OutOfMemoryError { byte[] data = Base64.decode(stream, Base64.DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); return bitmap; }
From source file:Main.java
public static void saveEncodedFile(String encoded, File file) throws Exception { byte[] decodedAsBytes = Base64.decode(encoded, Base64.DEFAULT); FileOutputStream os = new FileOutputStream(file, true); os.write(decodedAsBytes);/*from w ww. ja v a 2s. c o m*/ os.flush(); os.close(); }
From source file:Main.java
public static Bitmap toBitmap(String s) { //byte[] Buffer = s.getBytes(); byte[] buffer = Base64.decode(s, Base64.DEFAULT); //ByteArrayInputStream inputStream = new ByteArrayInputStream(Buffer); //Bitmap bitmap = BitmapFactory.decodeStream(inputStream); return BitmapFactory.decodeByteArray(buffer, 0, buffer.length, null); }
From source file:Main.java
public static byte[] base64Decode(byte[] input) { return Base64.decode(input, Base64.NO_WRAP); }
From source file:Main.java
public static Bitmap base64ToBitmap(String iconBase64) { byte[] bitmapArray; bitmapArray = Base64.decode(iconBase64, 0); return BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length); }
From source file:Main.java
public static byte[] toBytes(String base64) { try {/*from w w w. j av a 2s .c o m*/ return Base64.decode(base64.getBytes(CHARSET), Base64.NO_WRAP); } catch (Exception e) { return null; } }
From source file:Main.java
public static String base64decode(String base64) { String decoded = ""; try {/*from w w w . ja v a 2 s . co m*/ decoded = new String(Base64.decode(base64, Base64.DEFAULT), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return decoded; }