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