java.nio.file.FileSystem Java Examples
The following examples show how to use
java.nio.file.FileSystem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Archive.java From update4j with Apache License 2.0 | 8 votes |
public FileSystem openConnection() throws IOException { if (Files.notExists(getLocation())) { // I can't use Map.of("create", "true") since the overload taking a path was only added in JDK 13 // and using URI overload doesn't support nested zip files try (OutputStream out = Files.newOutputStream(getLocation(), StandardOpenOption.CREATE_NEW)) { // End of Central Directory Record (EOCD) out.write(new byte[] { 0x50, 0x4b, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); } } try { return FileSystems.newFileSystem(getLocation(), (ClassLoader) null); } catch (ProviderNotFoundException e) { ModuleFinder.ofSystem() .find("jdk.zipfs") .orElseThrow(() -> new ProviderNotFoundException( "Accessing the archive depends on the jdk.zipfs module which is missing from the JRE image")); throw e; } }
Example #2
Source File: TestClassIndexer.java From quarkus with Apache License 2.0 | 6 votes |
public static Index indexTestClasses(Class<?> testClass) { final Indexer indexer = new Indexer(); final Path testClassesLocation = getTestClassesLocation(testClass); try { if (Files.isDirectory(testClassesLocation)) { indexTestClassesDir(indexer, testClassesLocation); } else { try (FileSystem jarFs = FileSystems.newFileSystem(testClassesLocation, null)) { for (Path p : jarFs.getRootDirectories()) { indexTestClassesDir(indexer, p); } } } } catch (IOException e) { throw new UncheckedIOException("Unable to index the test-classes/ directory.", e); } return indexer.complete(); }
Example #3
Source File: ZipFSTester.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void z2zmove(FileSystem src, FileSystem dst, String path) throws IOException { Path srcPath = src.getPath(path); Path dstPath = dst.getPath(path); if (Files.isDirectory(srcPath)) { if (!Files.exists(dstPath)) mkdirs(dstPath); try (DirectoryStream<Path> ds = Files.newDirectoryStream(srcPath)) { for (Path child : ds) { z2zmove(src, dst, path + (path.endsWith("/")?"":"/") + child.getFileName()); } } } else { //System.out.println("moving..." + path); Path parent = dstPath.getParent(); if (parent != null && Files.notExists(parent)) mkdirs(parent); Files.move(srcPath, dstPath); } }
Example #4
Source File: BasicLib.java From rembulan with Apache License 2.0 | 6 votes |
static LuaFunction loadTextChunkFromFile(FileSystem fileSystem, ChunkLoader loader, String fileName, ByteString modeString, Object env) throws LoaderException { final LuaFunction fn; try { Path p = fileSystem.getPath(fileName); if (!modeString.contains((byte) 't')) { throw new LuaRuntimeException("attempt to load a text chunk (mode is '" + modeString + "')"); } // FIXME: this is extremely wasteful! byte[] bytes = Files.readAllBytes(p); ByteString chunkText = ByteString.copyOf(bytes); fn = loader.loadTextChunk(new Variable(env), fileName, chunkText.toString()); } catch (InvalidPathException | IOException ex) { throw new LoaderException(ex, fileName); } if (fn == null) { throw new LuaRuntimeException("loader returned nil"); } return fn; }
Example #5
Source File: FileSystemHandler.java From tiny-remapper with GNU Lesser General Public License v3.0 | 6 votes |
public static synchronized FileSystem open(URI uri) throws IOException { FileSystem ret = null; try { ret = FileSystems.getFileSystem(uri); } catch (FileSystemNotFoundException e) { } boolean opened; if (ret == null) { ret = FileSystems.newFileSystem(uri, Collections.emptyMap()); opened = true; } else { opened = false; } RefData data = fsRefs.get(ret); if (data == null) { fsRefs.put(ret, new RefData(opened, 1)); } else { data.refs++; } return ret; }
Example #6
Source File: TapChangeActionTest.java From ipst with Mozilla Public License 2.0 | 6 votes |
@Test public void testToTask() throws Exception { Network network = PhaseShifterTestCaseFactory.create(); PhaseTapChanger tapChanger = network.getTwoWindingsTransformer("PS1").getPhaseTapChanger(); assertEquals(1, tapChanger.getTapPosition()); TapChangeAction action = new TapChangeAction("PS1", 2); ModificationTask task = action.toTask(); try (FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix())) { Path localDir = fileSystem.getPath("/tmp"); ComputationManager computationManager = new LocalComputationManager(localDir); task.modify(network, computationManager); assertEquals(2, tapChanger.getTapPosition()); try { action.toTask(null); fail(); } catch (UnsupportedOperationException exc) { } } }
Example #7
Source File: FaultyFileSystem.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #8
Source File: ZipCat.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * The main method for the ZipCat program. Run the program with an empty * argument list to see possible arguments. * * @param args the argument list for ZipCat */ public static void main(String[] args) { if (args.length != 2) { System.out.println("Usage: ZipCat zipfile fileToPrint"); } /* * Creates AutoCloseable FileSystem and BufferedReader. * They will be closed automatically after the try block. * If reader initialization fails, then zipFileSystem will be closed * automatically. */ try (FileSystem zipFileSystem = FileSystems.newFileSystem(Paths.get(args[0]),null); InputStream input = Files.newInputStream(zipFileSystem.getPath(args[1]))) { byte[] buffer = new byte[1024]; int len; while ((len = input.read(buffer)) != -1) { System.out.write(buffer, 0, len); } } catch (IOException e) { e.printStackTrace(); System.exit(1); } }
Example #9
Source File: AthenzCredentialsMaintainer.java From vespa with Apache License 2.0 | 6 votes |
public AthenzCredentialsMaintainer(URI ztsEndpoint, Path trustStorePath, ConfigServerInfo configServerInfo, String certificateDnsSuffix, ServiceIdentityProvider hostIdentityProvider, boolean useInternalZts, Clock clock, FileSystem fileSystem) { this.ztsEndpoint = ztsEndpoint; this.trustStorePath = trustStorePath; this.configserverIdentity = configServerInfo.getConfigServerIdentity(); this.csrGenerator = new CsrGenerator(certificateDnsSuffix, configserverIdentity.getFullName()); this.hostIdentityProvider = hostIdentityProvider; this.fileSystem = fileSystem; this.identityDocumentClient = new DefaultIdentityDocumentClient( configServerInfo.getLoadBalancerEndpoint(), hostIdentityProvider, new AthenzIdentityVerifier(Set.of(configserverIdentity))); this.clock = clock; this.useInternalZts = useInternalZts; }
Example #10
Source File: FaultyFileSystem.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #11
Source File: TestIOUtils.java From lucene-solr with Apache License 2.0 | 6 votes |
public void testRotatingPlatters() throws Exception { assumeFalse("windows is not supported", Constants.WINDOWS); Path dir = createTempDir(); dir = FilterPath.unwrap(dir).toRealPath(); // fake ssd FileStore root = new MockFileStore(dir.toString() + " (/dev/zzz1)", "reiser4", "/dev/zzz1"); // make a fake /dev/zzz1 for it Path devdir = dir.resolve("dev"); Files.createDirectories(devdir); Files.createFile(devdir.resolve("zzz1")); // make a fake /sys/block/zzz/queue/rotational file for it Path sysdir = dir.resolve("sys").resolve("block").resolve("zzz").resolve("queue"); Files.createDirectories(sysdir); try (OutputStream o = Files.newOutputStream(sysdir.resolve("rotational"))) { o.write("1\n".getBytes(StandardCharsets.US_ASCII)); } Map<String,FileStore> mappings = Collections.singletonMap(dir.toString(), root); FileSystem mockLinux = new MockLinuxFileSystemProvider(dir.getFileSystem(), mappings, dir).getFileSystem(null); Path mockPath = mockLinux.getPath(dir.toString()); assertTrue(IOUtils.spinsLinux(mockPath)); }
Example #12
Source File: FaultyFileSystem.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public FileSystem newFileSystem(Path fakeRoot, Map<String,?> env) throws IOException { if (env != null && env.keySet().contains("IOException")) { triggerEx("IOException"); } synchronized (FaultyFSProvider.class) { if (delegate != null && delegate.isOpen()) throw new FileSystemAlreadyExistsException(); FaultyFileSystem result = new FaultyFileSystem(fakeRoot); delegate = result; return result; } }
Example #13
Source File: LocalComputationConfig.java From powsybl-core with Mozilla Public License 2.0 | 6 votes |
public static LocalComputationConfig load(PlatformConfig platformConfig, FileSystem fileSystem) { Objects.requireNonNull(platformConfig); Path localDir = getDefaultLocalDir(fileSystem); int availableCore = DEFAULT_AVAILABLE_CORE; if (platformConfig.moduleExists(CONFIG_MODULE_NAME)) { ModuleConfig config = platformConfig.getModuleConfig(CONFIG_MODULE_NAME); localDir = getTmpDir(config, "tmp-dir") .orElseGet(() -> getTmpDir(config, "tmpDir") .orElseGet(() -> getDefaultLocalDir(fileSystem))); availableCore = config.getOptionalIntProperty("available-core") .orElseGet(() -> config.getOptionalIntProperty("availableCore") .orElse(DEFAULT_AVAILABLE_CORE)); } if (availableCore <= 0) { availableCore = Runtime.getRuntime().availableProcessors(); } return new LocalComputationConfig(localDir, availableCore); }
Example #14
Source File: JavacPathFileManager.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private JavaFileObject getFileForInput(Location location, String relativePath) throws IOException { for (Path p: getLocation(location)) { if (isDirectory(p)) { Path f = resolve(p, relativePath); if (Files.exists(f)) return PathFileObject.createDirectoryPathFileObject(this, f, p); } else { FileSystem fs = getFileSystem(p); if (fs != null) { Path file = getPath(fs, relativePath); if (Files.exists(file)) return PathFileObject.createJarPathFileObject(this, file); } } } return null; }
Example #15
Source File: PythonDslProjectBuildFileParser.java From buck with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") private static ImmutableList<BuildFileParseExceptionStackTraceEntry> parseStackTrace( Map<String, Object> exceptionMap, FileSystem fileSystem) { List<Map<String, Object>> traceback = (List<Map<String, Object>>) Objects.requireNonNull(exceptionMap.get("traceback")); ImmutableList.Builder<BuildFileParseExceptionStackTraceEntry> stackTraceBuilder = ImmutableList.builder(); for (Map<String, Object> tracebackItem : traceback) { stackTraceBuilder.add( BuildFileParseExceptionStackTraceEntry.of( fileSystem.getPath((String) Objects.requireNonNull(tracebackItem.get("filename"))), (Number) Objects.requireNonNull(tracebackItem.get("line_number")), (String) Objects.requireNonNull(tracebackItem.get("function_name")), (String) Objects.requireNonNull(tracebackItem.get("text")))); } return stackTraceBuilder.build(); }
Example #16
Source File: ApkUtils.java From android-arscblamer with Apache License 2.0 | 6 votes |
/** * Finds all files in an apk that match a given regular expression. * * @param apkFile The {@link FileSystem} representation of the apk zip archive. * @param matcher A {@link PathMatcher} to match the requested filenames. * @return A list of paths matching the provided matcher. * @throws IOException Thrown if a matching file cannot be read from the apk. */ public static ImmutableList<Path> findFiles(FileSystem apkFile, PathMatcher matcher) throws IOException { ImmutableList.Builder<Path> result = ImmutableList.builder(); Path root = apkFile.getPath("/"); Files.walkFileTree( root, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path p, BasicFileAttributes attrs) throws IOException { if (matcher.matches(p) || matcher.matches(p.normalize())) { result.add( // fancy way of eliding leading slash root.relativize(p)); } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException e) { return FileVisitResult.SKIP_SUBTREE; } }); return result.build(); }
Example #17
Source File: ConversionTest.java From carbon-kernel with Apache License 2.0 | 6 votes |
private boolean isOSGiBundle(Path bundlePath, String bundleSymbolicName) throws IOException, CarbonToolException { if (Files.exists(bundlePath)) { boolean validSymbolicName, exportPackageAttributeCheck, importPackageAttributeCheck; try (FileSystem zipFileSystem = BundleGeneratorUtils.createZipFileSystem(bundlePath, false)) { Path manifestPath = zipFileSystem.getPath(Constants.JAR_MANIFEST_FOLDER, Constants.MANIFEST_FILE_NAME); Manifest manifest = new Manifest(Files.newInputStream(manifestPath)); Attributes attributes = manifest.getMainAttributes(); String actualBundleSymbolicName = attributes.getValue(Constants.BUNDLE_SYMBOLIC_NAME); validSymbolicName = ((actualBundleSymbolicName != null) && ((bundleSymbolicName != null) && bundleSymbolicName.equals(actualBundleSymbolicName))); exportPackageAttributeCheck = attributes.getValue(Constants.EXPORT_PACKAGE) != null; importPackageAttributeCheck = attributes.getValue(Constants.DYNAMIC_IMPORT_PACKAGE) != null; } return (validSymbolicName && exportPackageAttributeCheck && importPackageAttributeCheck); } else { return false; } }
Example #18
Source File: FastDownloaderFactoryTest.java From besu with Apache License 2.0 | 6 votes |
private void initDataDirectory(final boolean isPivotBlockHeaderFileExist) throws NoSuchFieldException { final File pivotBlockHeaderFile = mock(File.class); when(pivotBlockHeaderFile.isFile()).thenReturn(isPivotBlockHeaderFileExist); when(pivotBlockHeaderFile.isDirectory()).thenReturn(true); final File fastSyncDirFile = mock(File.class); when(fastSyncDirFile.isDirectory()).thenReturn(true); final Path storagePath = mock(Path.class); final FileSystem fileSystem = mock(FileSystem.class); when(storagePath.getFileSystem()).thenReturn(fileSystem); when(fileSystem.provider()).thenReturn(mock(FileSystemProvider.class)); final Path pivotBlockHeaderPath = mock(Path.class); when(pivotBlockHeaderPath.toFile()).thenReturn(pivotBlockHeaderFile); when(pivotBlockHeaderPath.resolve(anyString())).thenReturn(storagePath); final Path fastSyncDir = mock(Path.class); when(fastSyncDir.resolve(any(String.class))).thenReturn(pivotBlockHeaderPath); when(fastSyncDir.toFile()).thenReturn(fastSyncDirFile); when(dataDirectory.resolve(anyString())).thenReturn(fastSyncDir); }
Example #19
Source File: JarTest.java From capsule with Eclipse Public License 1.0 | 5 votes |
private static Manifest getManifest(Path jar, boolean useZipfs) throws IOException { if (useZipfs) { try (FileSystem zipfs = ZipFS.newZipFileSystem(jar)) { return new Manifest(Files.newInputStream(zipfs.getPath(JarFile.MANIFEST_NAME))); } } else return new JarInputStream(Files.newInputStream(jar)).getManifest(); }
Example #20
Source File: AppleSdkDiscoveryTest.java From buck with Apache License 2.0 | 5 votes |
@Test public void shouldScanRealDirectoryOnlyOnce() throws IOException { ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "sdk-discovery-symlink", temp); workspace.setUp(); Path root = workspace.getPath(""); FileSystem fileSystem = root.getFileSystem(); Path actualSdkPath = root.resolve("MacOSX10.9.sdk"); Path sdksDir = root.resolve("Platforms/MacOSX.platform/Developer/SDKs"); Files.createDirectories(sdksDir); // create relative symlink CreateSymlinksForTests.createSymLink( sdksDir.resolve("MacOSX10.9.sdk"), fileSystem.getPath("MacOSX.sdk")); // create absolute symlink CreateSymlinksForTests.createSymLink(sdksDir.resolve("MacOSX.sdk"), actualSdkPath); ImmutableMap<String, AppleToolchain> toolchains = ImmutableMap.of("com.apple.dt.toolchain.XcodeDefault", getDefaultToolchain(root)); ImmutableMap<AppleSdk, AppleSdkPaths> actual = AppleSdkDiscovery.discoverAppleSdkPaths( Optional.of(root), ImmutableList.of(root), toolchains, FakeBuckConfig.builder().build().getView(AppleConfig.class)); // if both symlinks were to be visited, exception would have been thrown during discovery assertThat(actual.size(), is(2)); }
Example #21
Source File: DefaultCellPathResolverTest.java From buck with Apache License 2.0 | 5 votes |
@Test public void errorMessageIncludesASpellingSuggestionForUnknownCells() { FileSystem vfs = Jimfs.newFileSystem(Configuration.unix()); DefaultCellPathResolver cellPathResolver = TestCellPathResolver.create( vfs.getPath("/foo/root"), ImmutableMap.of( "root", vfs.getPath("/foo/root"), "apple", vfs.getPath("/foo/cell"), "maple", vfs.getPath("/foo/cell"))); thrown.expectMessage("Unknown cell: mappl. Did you mean one of [apple, maple] instead?"); cellPathResolver.getCellPathOrThrow(Optional.of("mappl")); }
Example #22
Source File: NBJRTFileSystem.java From netbeans with Apache License 2.0 | 5 votes |
@CheckForNull public static NBJRTFileSystem create(File jdkHome) { final File jrtFsJar = NBJRTUtil.getNIOProvider(jdkHome); if (jrtFsJar == null) { return null; } try { final URLClassLoader jrtFsLoader = new URLClassLoader( new URL[] {BaseUtilities.toURI(jrtFsJar).toURL()}, ClassLoader.getSystemClassLoader()); final FileSystem fs = FileSystems.newFileSystem( URI.create(String.format("%s:/", //NOI18N PROTOCOL)), Collections.singletonMap(PROP_JAVA_HOME, jdkHome.getAbsolutePath()), jrtFsLoader); if (fs == null) { throw new IllegalStateException(String.format( "No %s provider.", //NOI18N PROTOCOL)); } return new NBJRTFileSystem(jdkHome, fs); } catch (IOException ex) { throw new IllegalStateException( String.format( "Cannot create %s NIO FS for: %s", //NOI18N PROTOCOL, jdkHome.getAbsolutePath()), ex); } }
Example #23
Source File: ConversionTester.java From powsybl-core with Mozilla Public License 2.0 | 5 votes |
public void validateBusBalances(Network network) throws IOException { try (FileSystem fs = Jimfs.newFileSystem(Configuration.unix())) { ValidationConfig config = loadFlowValidationConfig(validateBusBalancesThreshold); Path working = Files.createDirectories(fs.getPath("lf-validation")); computeMissingFlows(network, config.getLoadFlowParameters()); assertTrue(ValidationType.BUSES.check(network, config, working)); } }
Example #24
Source File: ClassLoaderHelper.java From ForgeHax with MIT License | 5 votes |
/** * Generates a list of all the paths that have the file extension '.class' * * @param jarFile jar file * @param packageDir path to the package * @param recursive if the scan should look into sub directories * @return a list of class paths * @throws IOException if there is an issue opening/reading the files */ public static List<Path> getClassPathsInJar(JarFile jarFile, String packageDir, boolean recursive) throws IOException { Objects.requireNonNull(jarFile); Objects.requireNonNull(packageDir); // open new file system to the jar file final FileSystem fs = newFileSystem(jarFile.getName()); final Path root = fs.getRootDirectories().iterator().next(); final Path packagePath = root.resolve(packageDir); return Streamables.enumerationStream(jarFile.entries()) .map(entry -> root.resolve(entry.getName())) .filter(path -> getFileExtension(path).equals("class")) .filter( path -> recursive || path.getNameCount() == packagePath.getNameCount() + 1) // name count = directories, +1 for the class file name .filter( path -> path.toString().startsWith(path.getFileSystem().getSeparator() + packageDir) && path.toString().length() > (packageDir.length() + 2)) // 2 = root (first) '/' + suffix '/' .collect(Collectors.toList()); }
Example #25
Source File: CustomLauncherTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static Path findLibjvm(FileSystem FS) { Path libjvmPath = findLibjvm(FS.getPath(TEST_JDK, "jre", "lib", LIBARCH)); if (libjvmPath == null) { libjvmPath = findLibjvm(FS.getPath(TEST_JDK, "lib", LIBARCH)); } return libjvmPath; }
Example #26
Source File: MCRStoreCenterTest.java From mycore with GNU General Public License v3.0 | 5 votes |
FakeStoreConfig(String id) throws IOException { String fsName = MCRStoreCenterTest.class.getSimpleName() + "." + id; URI jimfsURI = URI.create("jimfs://" + fsName); FileSystem fileSystem; try { fileSystem = FileSystems.getFileSystem(jimfsURI); } catch (FileSystemNotFoundException e) { fileSystem = Jimfs.newFileSystem(fsName, Configuration.unix()); } baseDir = fileSystem.getPath("/"); }
Example #27
Source File: DeleteInterference.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void openAndCloseWatcher(Path dir) { FileSystem fs = FileSystems.getDefault(); for (int i = 0; i < ITERATIONS_COUNT; i++) { try (WatchService watcher = fs.newWatchService()) { dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY); } catch (IOException ioe) { // ignore } } }
Example #28
Source File: TestIOUtils.java From lucene-solr with Apache License 2.0 | 5 votes |
public void testTmpfsDoesntSpin() throws Exception { Path dir = createTempDir(); dir = FilterPath.unwrap(dir).toRealPath(); // fake tmpfs FileStore root = new MockFileStore(dir.toString() + " (/dev/sda1)", "tmpfs", "/dev/sda1"); Map<String,FileStore> mappings = Collections.singletonMap(dir.toString(), root); FileSystem mockLinux = new MockLinuxFileSystemProvider(dir.getFileSystem(), mappings, dir).getFileSystem(null); Path mockPath = mockLinux.getPath(dir.toString()); assertFalse(IOUtils.spinsLinux(mockPath)); }
Example #29
Source File: ZipUtils.java From quarkus with Apache License 2.0 | 5 votes |
public static void zip(Path src, Path zipFile) throws IOException { try (FileSystem zipfs = newZip(zipFile)) { if (Files.isDirectory(src)) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(src)) { for (Path srcPath : stream) { copyToZip(src, srcPath, zipfs); } } } else { Files.copy(src, zipfs.getPath(src.getFileName().toString()), StandardCopyOption.REPLACE_EXISTING); } } }
Example #30
Source File: TestFinder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static Path[] getExcludeDirs() { final String excludeDirs[] = System.getProperty(TEST_JS_EXCLUDE_DIR, "test/script/currently-failing").split(" "); final Path[] excludePaths = new Path[excludeDirs.length]; final FileSystem fileSystem = FileSystems.getDefault(); int i = 0; for (final String excludeDir : excludeDirs) { excludePaths[i++] = fileSystem.getPath(excludeDir); } return excludePaths; }