Here you can find the source of toBitmap(InputStream is)
public static Bitmap toBitmap(InputStream is) throws IOException
//package com.java2s; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import java.io.*; public class Main { public static Bitmap toBitmap(InputStream is) throws IOException { if (null == is) { return null; }//from ww w .java2s . c o m return toBitmapDrawable(is).getBitmap(); } public static BitmapDrawable toBitmapDrawable(InputStream is) throws IOException { BitmapDrawable bitmapDrawable = new BitmapDrawable(is); is.close(); return bitmapDrawable; } }