If we have a File
by the name of f
, is there any real difference between
BitmapFactory.decodeStream(new FileInputStream(f))
and
BitmapFactory.decodeFile(f.getAbsolutePath())
No.
Here is the entirety of the decodeFile()
method, from the now-current source code:
public static Bitmap decodeFile(String pathName, Options opts) {
Bitmap bm = null;
InputStream stream = null;
try {
stream = new FileInputStream(pathName);
bm = decodeStream(stream, null, opts);
} catch (Exception e) {
/* do nothing.
If the exception happened on open, bm will be null.
*/
Log.e("BitmapFactory", "Unable to decode stream: " + e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// do nothing here
}
}
}
return bm;
}
It is not materially different from what you or I would do.