Code example for ByteArrayOutputStream

Methods: closetoByteArray

0
 
			bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
		} 
 
		String type = context.getContentResolver().getType(photoUri);
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		if (type.equals("image/png")) {
			bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
		} 
		else if (type.equals("image/jpg") || type.equals("image/jpeg")) {
			bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
		} 
		byte[] bMapArray = baos.toByteArray();
		baos.close();
		return bMapArray;
	} 
 
	public int getOrientation(Context context, Uri photoUri) {
		/* it's on the external media. */ 
		Cursor cursor = context.getContentResolver().query(photoUri, new String[] { MediaStore.Images.ImageColumns.ORIENTATION }, null, null, null);
Stop searching for code, let great code find you!  Add Codota to your java IDE