How expensive is File.exists in Java
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am wondering how File.exists() works. I'm not very aware of how filesystems work, so I should maybe start reading there first. But for a quick pre information: Is a call to File.exists() a single action for the filesystem, if that path and filename are registered in some journal? Or does the OS get the content of the directory and then scan through it for matches? I presume this will be filesystem dependant, but maybe all filesystems use the quick approach? I'm not talking about network and tape systems. Lets keep it to ntfs, extX, zfs,