java.nio.file.spi.FileSystemProvider#newFileSystem ( )源码实例Demo

下面列出了java.nio.file.spi.FileSystemProvider#newFileSystem ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: JavacFileManager.java
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;
                        }
                    }
                });
    }
}
 
源代码2 项目: synthea   文件: Module.java
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());
        }
      }
    }
  }
}
 
源代码3 项目: dragonwell8_jdk   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码4 项目: TencentKona-8   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码5 项目: jdk8u60   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码6 项目: openjdk-jdk8u   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
/**
 * 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);
}
 
源代码8 项目: openjdk-jdk9   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码9 项目: jdk8u-jdk   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码10 项目: hottub   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码11 项目: openjdk-8-source   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码12 项目: openjdk-8   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码13 项目: jdk8u_jdk   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码14 项目: jdk8u-jdk   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码15 项目: jdk8u-dev-jdk   文件: PassThroughFileSystem.java
/**
 * 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);
}
 
源代码16 项目: boon   文件: IO.java
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;
    }
 
源代码17 项目: jimfs   文件: SystemJimfsFileSystemProvider.java
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env) throws IOException {
  FileSystemProvider realProvider = path.getFileSystem().provider();
  return realProvider.newFileSystem(path, env);
}