java - Android 中的 AssetFileDescriptor 是否必须关闭

标签 java android

Android API 中的 AssetFileDescriptor 确实有一个 close method .但是,文档指出这只是一种方便的方法。

AssetFileDescriptor 对象在使用后是否总是需要关闭?

最佳答案

是的,你需要调用它。我建议使用 try-with-resources为了方便而构建。如果你不想方便,那么你可以调用 getParcelFileDescriptor().close() ;).

关于java - Android 中的 AssetFileDescriptor 是否必须关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36264468/

相关文章:

android - Android 中的位置提供者?

java - 开始时更新菜单

java - 语法错误,插入 ";"和 ")"找不到错误

java - android 服务关闭后继续

java - 在没有html firebug扩展的javascript中调用java方法

java : Sort Java Vector

android SurfaceControl 截图返回null

java - Pivot Cloud Foundry 错误 : "Browser detection failed and system property h2.browser not set" - Spring Boot 2

Kotlin 密封类类型检测的 Java 等价物

java - 仅对表中选定的行启用编辑