类(class)BasicFileAttributes ,用于检查文件系统中文件的属性,有方法isRegularFile() .不幸的是,Javadoc 描述相当缺乏:
Tells whether the file is a regular file with opaque content.
这是什么意思?什么是内容不透明的常规文件?我可以从类中的其他方法中看出它不是目录或符号链接(symbolic link),所以我倾向于认为它是其他一切。但是,显然存在某种类型的“不规则文件”,因为存在一种名为 isOther() 的方法。 ,如果它不是目录、符号链接(symbolic link)或“常规文件”,则返回 true。
那么 Java 中的常规文件到底是什么?
最佳答案
例如,在 UNIX 中,常规文件在某些方面并不特殊。特殊文件包括符号链接(symbolic link)和目录。常规文件是永久存储在文件系统中的字节序列。
阅读此答案@UNIX 和 Linux stackexchange:What is a regular file?
I figure rm -i is an alias, possibly rm -i. The "regular" part doesn't mean anything in particular, it only means that it's not a pipe, device, socket or anything other "special".
it means the file is not a symlink, pipe, rand, null, cpu, etc. Perhaps you have heard the linux philosophy everything is a text. This isn't literally true, but it suggests a dominant operational context where string processing tools can be applied to filesystem elements directly. In this case, it means that in a more literal fashion. To see the detection step in isolation, try the command file, as in file /etc/passwd or file /dev/null.
关于java - Java 中的 "regular file"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20547268/