Java Code Examples for java.nio.file.spi.FileSystemProvider#newFileSystem()
The following examples show how to use
java.nio.file.spi.FileSystemProvider#newFileSystem() .
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: Module.java From synthea with Apache License 2.0 | 7 votes |
private static void fixPathFromJar(URI uri) throws IOException { // this function is a hack to enable reading modules from within a JAR file // see https://stackoverflow.com/a/48298758 if ("jar".equals(uri.getScheme())) { for (FileSystemProvider provider: FileSystemProvider.installedProviders()) { if (provider.getScheme().equalsIgnoreCase("jar")) { try { provider.getFileSystem(uri); } catch (FileSystemNotFoundException e) { // in this case we need to initialize it first: provider.newFileSystem(uri, Collections.emptyMap()); } } } } }
Example 2
Source File: JavacFileManager.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public ArchiveContainer(Path archivePath) throws IOException, ProviderNotFoundException, SecurityException { this.archivePath = archivePath; if (multiReleaseValue != null && archivePath.toString().endsWith(".jar")) { Map<String,String> env = Collections.singletonMap("multi-release", multiReleaseValue); FileSystemProvider jarFSProvider = fsInfo.getJarFSProvider(); Assert.checkNonNull(jarFSProvider, "should have been caught before!"); this.fileSystem = jarFSProvider.newFileSystem(archivePath, env); } else { this.fileSystem = FileSystems.newFileSystem(archivePath, null); } packages = new HashMap<>(); for (Path root : fileSystem.getRootDirectories()) { Files.walkFileTree(root, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { if (isValid(dir.getFileName())) { packages.put(new RelativeDirectory(root.relativize(dir).toString()), dir); return FileVisitResult.CONTINUE; } else { return FileVisitResult.SKIP_SUBTREE; } } }); } }
Example 3
Source File: PassThroughFileSystem.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 4
Source File: IO.java From boon with Apache License 2.0 | 5 votes |
public static FileSystem zipFileSystem( URI fileJarURI ) { final Map<String, Object> env = Maps.map( "create", ( Object ) "true" ); FileSystemProvider provider = loadFileSystemProvider("jar"); requireNonNull( provider, "Zip file provider not found" ); FileSystem fs = null; try { fs = provider.getFileSystem( fileJarURI ); } catch ( Exception ex ) { if ( provider != null ) { try { fs = provider.newFileSystem( fileJarURI, env ); } catch ( IOException ex2 ) { Exceptions.handle( FileSystem.class, sputs( "unable to load", fileJarURI, "as zip file system" ), ex2 ); } } } requireNonNull( provider, "Zip file system was not found" ); return fs; }
Example 5
Source File: PassThroughFileSystem.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 6
Source File: PassThroughFileSystem.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 7
Source File: PassThroughFileSystem.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 8
Source File: PassThroughFileSystem.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 9
Source File: PassThroughFileSystem.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 10
Source File: PassThroughFileSystem.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 11
Source File: PassThroughFileSystem.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 12
Source File: PassThroughFileSystem.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 13
Source File: PassThroughFileSystem.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 14
Source File: PassThroughFileSystem.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 15
Source File: PassThroughFileSystem.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 16
Source File: PassThroughFileSystem.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new "pass through" file system. Useful for test environments * where the provider might not be deployed. */ static FileSystem create() throws IOException { FileSystemProvider provider = new PassThroughProvider(); Map<String,?> env = Collections.emptyMap(); URI uri = URI.create("pass:///"); return provider.newFileSystem(uri, env); }
Example 17
Source File: SystemJimfsFileSystemProvider.java From jimfs with Apache License 2.0 | 4 votes |
@Override public FileSystem newFileSystem(Path path, Map<String, ?> env) throws IOException { FileSystemProvider realProvider = path.getFileSystem().provider(); return realProvider.newFileSystem(path, env); }