List of usage examples for java.io ByteArrayOutputStream toByteArray
public synchronized byte[] toByteArray()
From source file:Main.java
public static String getBitmapStrBase64(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] bytes = baos.toByteArray(); return Base64.encodeToString(bytes, 0); }
From source file:Main.java
public static String BitMapToString(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] arr = baos.toByteArray(); String result = Base64.encodeToString(arr, Base64.DEFAULT); return result; }
From source file:Main.java
/** * @brief Converting bitmap to bytes array. * //from w ww . jav a 2 s .co m * @param bm [IN] bitmap object * * @return Return converted bytes array */ public static byte[] bitmapToBytes(Bitmap bm) { if (bm == null) { return null; } final ByteArrayOutputStream os = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, os); return os.toByteArray(); }
From source file:Main.java
public static byte[] document2Bytes(Document document, String encode) throws TransformerException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); document2OutputStream(document, encode, baos); return baos.toByteArray(); }
From source file:Main.java
public static byte[] bitmapToByteArray(Bitmap bmp) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(CompressFormat.JPEG, 60, stream); byte[] byteArray = stream.toByteArray(); return byteArray; }
From source file:Main.java
public static String bitmapToString(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] arr = baos.toByteArray(); String result = Base64.encodeToString(arr, Base64.DEFAULT); return result; }
From source file:Main.java
public static byte[] bitmapToByteArray(Bitmap bitmap) { ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, out); return out.toByteArray(); }
From source file:Main.java
public static byte[] bitmapToByteArray(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.JPEG, 100, stream); byte[] byteArray = stream.toByteArray(); return byteArray; }
From source file:Main.java
public static byte[] formatDOM(Node node, String encoding) { ByteArrayOutputStream out = new ByteArrayOutputStream(4096); printDOM(node, out);//from w ww .j av a 2 s. c o m return out.toByteArray(); }
From source file:Main.java
private static long getSizeOfBitmap(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); long length = baos.toByteArray().length / 1024; return length; }