public static ImmutableList<Path> listFiles(Path dir) throws IOException {
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
      return ImmutableList.copyOf(stream);
    } catch (DirectoryIteratorException e) {
      throw e.getCause();
    }
  }
public static ImmutableList<Path> listFiles(Path dir) throws IOException {
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
      return ImmutableList.copyOf(stream);
    } catch (DirectoryIteratorException e) {
      throw e.getCause();
    }
  }
public static ImmutableList < Path > listFiles ( Path dir ) throws IOException { try ( DirectoryStream < Path > stream = Files . newDirectoryStream ( dir ) ) { return ImmutableList . copyOf ( stream ) ; } catch ( DirectoryIteratorException e ) { throw e . getCause ( ) ; } }
Returns an immutable list of paths to the files contained in the given directory.

@throws NoSuchFileException if the file does not exist <i>(optional specific exception)</i>
@throws NotDirectoryException if the file could not be opened because it is not a directory
<i>(optional specific exception)</i>
@throws IOException if an I/O error occurs
Returns an immutable list of paths to the files contained in the given directory .