android - 使用 Bitmap.compress() 时是否需要进一步关闭 FileOutputStream?

标签 android bitmap

我在网上看到的大多数例子都类似于:

FileOutputStream out = new FileOutputStream(someFilename);
someBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);

是否需要任何额外的工作来关闭流并确保它被正确地刷新到磁盘?

最佳答案

你绝对应该在流上调用 close() :)

关于android - 使用 Bitmap.compress() 时是否需要进一步关闭 FileOutputStream?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5164456/

相关文章:

java - 使用 LibGDX SpriteBatches 缩放图像

android - 我需要在我的 Android 应用程序中实现通知提醒

android - ImageView 未出现在小部件中

android - 在后台android中更新时从concurrentHashMap访问数据

android - 如何使用矩阵在中心点上旋转android中的位图

c++ - 如何在 C++ 中就地转置位图

language-agnostic - 是(宽,高)还是(高,宽)?

java - SELECT MAX(column) 只返回列名

android - 如何在 android 上使用 native 堆作为位图

java - 加载位图时应用程序 UI 变得无响应