public static boolean isRegularFile (Path path, LinkOption… options)

Tests whether a file is a regular file with opaque content.

The options array may be used to indicate how symbolic links are handled for the case that the file is a symbolic link. By default, symbolic links are followed and the file attribute of the final target of the link is read. If the option NOFOLLOW_LINKS is present then symbolic links are not followed.

Where it is required to distinguish an I/O exception from the case that the file is not a regular file then the file attributes can be read with the readAttributes(Path,Class,LinkOption[]) method and the file type tested with the BasicFileAttributes.isRegularFile method.

Parameters:
path     the path to the file
options     options indicating how symbolic links are handled

Returns:  true if the file is a regular file; false if the file does not exist, is not a regular file, or it cannot be determined if the file is a regular file or not.

Exceptions:
SecurityException     In the case of the default provider, and a security manager is installed, its checkRead method denies read access to the file.