List of usage examples for java.io ByteArrayOutputStream toByteArray
public synchronized byte[] toByteArray()
From source file:Main.java
public static byte[] bmp2byteArray(Bitmap bitmap, Bitmap.CompressFormat format, int compressVal) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(format, compressVal, baos); return baos.toByteArray(); }
From source file:Main.java
public static byte[] bitmapToByteArray(Bitmap bitmap) { ByteArrayOutputStream os = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, os); return os.toByteArray(); }
From source file:Main.java
public static byte[] Bitmap2Bytes(Bitmap bm) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); return baos.toByteArray(); }
From source file:Main.java
public static byte[] Bitmap2Bytes(Bitmap bm) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos.toByteArray(); }
From source file:Main.java
public static byte[] getByteFromBitmap(Bitmap bitmap, Bitmap.CompressFormat compressFormat) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(compressFormat, 100, baos); return baos.toByteArray(); }
From source file:Main.java
/** * Bitmap to Data//from w w w. j av a 2s .c om * @param src Bitmap * @param format Bitmap.CompressFormat * @param quality int * @return byte[] */ public static byte[] chngBmpToData(Bitmap src, Bitmap.CompressFormat format, int quality) { ByteArrayOutputStream output = new ByteArrayOutputStream(); src.compress(format, quality, output); return output.toByteArray(); }
From source file:Main.java
public static byte[] bitmapToBytes(Bitmap bm) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos.toByteArray(); }
From source file:Main.java
public static byte[] Bitmap2ByteArray(Bitmap bm) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos.toByteArray(); }
From source file:Main.java
public static byte[] bitmap2Bytes(Bitmap bitmap, Bitmap.CompressFormat format) { if (bitmap == null) return null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(format, 100, baos);/*w ww . j ava 2 s .c om*/ return baos.toByteArray(); }
From source file:Main.java
public static String serializerXmlString(Object xmlObj) throws JAXBException, ParserConfigurationException { ByteArrayOutputStream baos = (ByteArrayOutputStream) serializerOutputStream(xmlObj); byte[] bystr = baos.toByteArray(); String str = ""; try {//from ww w .ja v a 2 s.co m str = new String(bystr, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; }