3030import java .nio .file .Files ;
3131import java .nio .file .LinkOption ;
3232import java .nio .file .NoSuchFileException ;
33+ import java .nio .file .NotDirectoryException ;
3334import java .nio .file .OpenOption ;
3435import java .nio .file .Path ;
3536import java .nio .file .Paths ;
@@ -732,7 +733,12 @@ public static boolean isEmpty(final Path path) throws IOException {
732733 *
733734 * @param directory the directory to query.
734735 * @return whether the directory is empty.
735- * @throws IOException if an I/O error occurs.
736+ * @throws NotDirectoryException if the file could not otherwise be opened because it is not a directory
737+ * <i>(optional specific exception)</i>.
738+ * @throws IOException if an I/O error occurs.
739+ * @throws SecurityException In the case of the default provider, and a security manager is installed, the
740+ * {@link SecurityManager#checkRead(String) checkRead} method is invoked to check read
741+ * access to the directory.
736742 */
737743 public static boolean isEmptyDirectory (final Path directory ) throws IOException {
738744 try (DirectoryStream <Path > directoryStream = Files .newDirectoryStream (directory )) {
@@ -745,7 +751,10 @@ public static boolean isEmptyDirectory(final Path directory) throws IOException
745751 *
746752 * @param file the file to query.
747753 * @return whether the file is empty.
748- * @throws IOException if an I/O error occurs.
754+ * @throws IOException if an I/O error occurs.
755+ * @throws SecurityException In the case of the default provider, and a security manager is installed, its
756+ * {@link SecurityManager#checkRead(String) checkRead} method denies read access to the
757+ * file.
749758 */
750759 public static boolean isEmptyFile (final Path file ) throws IOException {
751760 return Files .size (file ) <= 0 ;
0 commit comments