什么是Java中的“常规文件”?

用于检查文件系统中的文件的属性的类BasicFileAttributes具有方法isRegularFile().不幸的是Javadoc的描述是相当缺乏的:

Tells whether the file is a regular file with opaque content.

这是什么意思?什么是具有不透明内容的常规文件?我可以从类中的其他方法中得知,它不是一个目录或符号链接,所以我倾向于认为它是一切。然而,显然是某种类型的“不规则文件”,因为存在一个称为isOther()的方法,如果它不是目录,符号链接或“常规文件”,则返回true。

那么Java中的常规文件究竟是什么呢?

例如在UNIX中,常规文件是以某种方式不是特殊的。特殊文件包括符号链接和目录。常规文件是永久存储在文件系统中的字节序列。

阅读这个答案@ 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.

http://stackoverflow.com/questions/20547268/what-is-a-regular-file-in-java

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:什么是Java中的“常规文件”?