java - Java 中的 "regular file"是什么?

标签 java nio

类(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/

相关文章:

java - 如何使用elasticsearch Java API使用wildCardQuery方法?

java - 在 linux lubuntu 上调用任何 java.nio 方法时没有遇到这样的方法异常

java nio注册写操作后无法读取

java - 使用 java.nio.FileSystems 操作 DOCX 文件

java - 如何在 AsynchronousSocketChannel 上正确同步并发读取和写入

java - 蔚来。监听同一个端口的多个客户端 channel

java - Icefaces 性能问题 - 部分提交

java - 从带有 Map 的对象到带有属性的 Pojo 的 Dozer 映射

java - 在计算之前判断指数是否高于长阈值

java - 图像在 JavaFx 中不显示