如何从 cache 文件和 web 中解码 bitmap?

我使用下面的方法来检索一个bitmap:

private Bitmap getBitmap(String url) 
{
    File f=fileCache.getFile(url);
     //from SD cache
    if(b!=null)
        return b;
     //from web
    try {
        Bitmap bitmap=null;
        Log.e("URL", url);
        URL imageUrl = new URL(url);
        HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
        conn.setConnectTimeout(30000);
        conn.setReadTimeout(30000);
        InputStream is=conn.getInputStream();
        OutputStream os = new FileOutputStream(f);
        Utils.CopyStream(is, os);
        os.close();
        return bitmap;
    } catch (Exception ex){
       ex.printStackTrace();
       return null;
    }
}

如上所述,我要如何解码bitmap是来自SDcard 还是 cache?或者从web代码获得?

return BitmapFactory.decodeFile(url);

return BitmapFactory.decodeStream(is);