3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jdk.tools.jaotc.collect;
24
25 import java.nio.file.FileSystem;
26 import java.nio.file.Path;
27 import java.nio.file.Paths;
28 import java.util.ArrayList;
29 import java.util.List;
30
31 public class SearchPath {
32 private final List<Path> searchPaths = new ArrayList<>();
33 private final FileSupport fileSupport;
34
35 public SearchPath() {
36 this(new FileSupport());
37 }
38
39 public SearchPath(FileSupport fileSupport) {
40 this.fileSupport = fileSupport;
41 }
42
67 }
68
69 return null;
70 }
71
72 private boolean isAbsolute(Path entry) {
73 return fileSupport.isAbsolute(entry);
74 }
75
76 private boolean exists(Path entry) {
77 return fileSupport.exists(entry);
78 }
79
80 public void add(String... paths) {
81 for (String name : paths) {
82 Path path = Paths.get(name);
83 searchPaths.add(path);
84 }
85 }
86 }
87
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package jdk.tools.jaotc.collect;
25
26 import java.nio.file.FileSystem;
27 import java.nio.file.Path;
28 import java.nio.file.Paths;
29 import java.util.ArrayList;
30 import java.util.List;
31
32 public class SearchPath {
33 private final List<Path> searchPaths = new ArrayList<>();
34 private final FileSupport fileSupport;
35
36 public SearchPath() {
37 this(new FileSupport());
38 }
39
40 public SearchPath(FileSupport fileSupport) {
41 this.fileSupport = fileSupport;
42 }
43
68 }
69
70 return null;
71 }
72
73 private boolean isAbsolute(Path entry) {
74 return fileSupport.isAbsolute(entry);
75 }
76
77 private boolean exists(Path entry) {
78 return fileSupport.exists(entry);
79 }
80
81 public void add(String... paths) {
82 for (String name : paths) {
83 Path path = Paths.get(name);
84 searchPaths.add(path);
85 }
86 }
87 }
|