langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java
changeset 22163 3651128c74eb
parent 19924 d45df0a53e20
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
   100     @Override
   100     @Override
   101     Iterable<DocFile> list(Location location, DocPath path) {
   101     Iterable<DocFile> list(Location location, DocPath path) {
   102         if (location != StandardLocation.SOURCE_PATH)
   102         if (location != StandardLocation.SOURCE_PATH)
   103             throw new IllegalArgumentException();
   103             throw new IllegalArgumentException();
   104 
   104 
   105         Set<DocFile> files = new LinkedHashSet<DocFile>();
   105         Set<DocFile> files = new LinkedHashSet<>();
   106         if (fileManager.hasLocation(location)) {
   106         if (fileManager.hasLocation(location)) {
   107             for (Path f: fileManager.getLocation(location)) {
   107             for (Path f: fileManager.getLocation(location)) {
   108                 if (Files.isDirectory(f)) {
   108                 if (Files.isDirectory(f)) {
   109                     f = f.resolve(path.getPath());
   109                     f = f.resolve(path.getPath());
   110                     if (Files.exists(f))
   110                     if (Files.exists(f))
   219             }
   219             }
   220         }
   220         }
   221 
   221 
   222         /** If the file is a directory, list its contents. */
   222         /** If the file is a directory, list its contents. */
   223         public Iterable<DocFile> list() throws IOException {
   223         public Iterable<DocFile> list() throws IOException {
   224             List<DocFile> files = new ArrayList<DocFile>();
   224             List<DocFile> files = new ArrayList<>();
   225             try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
   225             try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
   226                 for (Path f: ds) {
   226                 for (Path f: ds) {
   227                     files.add(new StandardDocFile(f));
   227                     files.add(new StandardDocFile(f));
   228                 }
   228                 }
   229             }
   229             }