内容简介:这个答案有一个很好的解释:翻译自:https://stackoverflow.com/questions/22606121/file-deleteonexit-unix-trick-from-comments
以下是此方法的源注释:
Note that onAndroid, the application lifecycle does not include VM termination,
so calling this method will not ensure that files are deleted. Instead, you should
use the most appropriate out of:
* Use a {@code finally} clause to manually invoke {@link #delete}.
* Maintain your own set of files to delete, and process it at an appropriate point
in your application's lifecycle.
* Use the Unix trick of deleting the file as soon as all readers and writers have
opened it. No new readers/writers will be able to access the file, but all existing
ones will still have access until the last one closes the file.
任何人都可以向我解释它中提到的“Unix技巧”是什么以及如何使用它?
这个答案有一个很好的解释: https://stackoverflow.com/a/5219960/200508 .基本上,这意味着“删除”Unix系统上的文件不会立即从磁盘上删除它;相反,它只是从它所在的目录中删除对该文件的引用.该文件实际上不会被删除,直到所有使用它的进程终止.因此,您可以打开一个临时文件并立即删除它,然后每当程序终止时它将被自动擦除.
翻译自:https://stackoverflow.com/questions/22606121/file-deleteonexit-unix-trick-from-comments
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 来自首次Ray聚会的记录
- 来自程序员老婆的吐槽
- 来自GitHub的系列渗透测试工具
- 深度揭秘:来自朝鲜的加密黑客组织Lazarus
- 来自Java高级架构师的晋级心得
- 高质量前端快照方案:来自页面的 “自拍”
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
推荐系统
[奥地利] Dietmar Jannach、Markus Zanker、Alexander Felfernig、Gerhard Friedrich / 蒋 凡 / 人民邮电出版社 / 2013-6-25 / 59.00元
编辑推荐: 通过对本书的学习,读者不仅可以全面系统地了解该领域的基础原理,还能试验如何搭建一套真正的推荐系统。 —— 百度主任架构师、百度技术委员会主席 廖若雪 本书比较全面地介绍了推荐系统涉及的相关知识点,很适合对于推荐系统感兴趣的相关人员作为入门教程,目前能够系统全面介绍相关技术的中文书籍还显得匮乏,相信这本译著对于缓解这种情况大有裨益。 ——新浪微博数据挖掘技术专家 ......一起来看看 《推荐系统》 这本书的介绍吧!