gpt4 book ai didi

java - BitmapFactory.decodeFile 与 decodeStream 之间的区别

转载 作者:行者123 更新时间:2023-11-29 19:57:49 25 4
gpt4 key购买 nike

如果我们有一个名为fFile

BitmapFactory.decodeStream(new FileInputStream(f))

BitmapFactory.decodeFile(f.getAbsolutePath())

最佳答案

没有。

这是 decodeFile() 方法的全部内容,来自 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;
}

这与您或我的做法没有本质区别。

关于java - BitmapFactory.decodeFile 与 decodeStream 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36554380/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com