Here we have the description of isRegularFile()
method of the BasicFileAttributes
interface:
Tells whether the file is a regular file with opaque content.
What do they mean by "opaque content", not visible? and if so, does it mean that a file with transparent content is not a regular file? Thanks in advance.
It means that under the hood, the API makes no effort to look inside the file to determine whether it really is a "regular file". A file can appear to be a regular file but might actually be encrypted, a virtual file system for some application, or any number of other things that Java doesn't know about. Java only relies on the directory entry or whatever other metadata about it is provided by the underlying operating system.
I think this question better addresses the issue. Namely, in some operating systems, physical hardware devices and also "special" devices can be addressed in the same way as files are. In linux/unix, /home/interestingDocument.txt
could be a file, but /dev/hda
or /dev/null
is usually a device and NOT a file. Other things that do exist but are not files include things like links, etc.
What is a "regular file" in Java?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With