List of usage examples for android.util Base64 DEFAULT
int DEFAULT
To view the source code for android.util Base64 DEFAULT.
Click Source Link
From source file:Main.java
public static String encode(String toEncodeContent) { if (toEncodeContent == null) { return null; }/*from w w w . jav a 2 s . co m*/ return Base64.encodeToString(toEncodeContent.getBytes(), Base64.DEFAULT); }
From source file:Main.java
public static Bitmap decodeBase64Image(String encodedImage) { byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT); return BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); }
From source file:Main.java
public static Bitmap decodeBase64(String input) { try {//from ww w .j ava 2 s. co m byte[] decodedBytes = Base64.decode(input, Base64.DEFAULT); return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length); } catch (IllegalArgumentException e) { return null; } }
From source file:Main.java
public static byte[] decodeBase64(byte[] data) { if (data == null) { return null; }//ww w.j a va2 s . com return Base64.decode(data, Base64.DEFAULT); }
From source file:Main.java
public static byte[] encodeBase64(byte[] data) { if (data == null) { return null; }//from ww w .j a v a2 s. c o m return Base64.encode(data, Base64.DEFAULT); }
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 String bitmap2JPGBase64(Bitmap bitmap) { return Base64.encodeToString(bitmap2JPGByteArray(bitmap), Base64.DEFAULT); }
From source file:Main.java
public static String bitmap2PNGBase64(Bitmap bitmap) { return Base64.encodeToString(bitmap2PNGByteArray(bitmap), Base64.DEFAULT); }
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 w w . j a v a2 s .c o m os.flush(); os.close(); }