Example usage for java.nio.file FileSystems newFileSystem

List of usage examples for java.nio.file FileSystems newFileSystem

Introduction

In this page you can find the example usage for java.nio.file FileSystems newFileSystem.

Prototype

public static FileSystem newFileSystem(Path path, Map<String, ?> env, ClassLoader loader) throws IOException 

Source Link

Document

Constructs a new FileSystem to access the contents of a file as a file system.

Usage

From source file:org.nuxeo.ecm.webengine.gwt.GwtResolver.java

protected File install(URI location) throws IOException {
    if ("jar".equals(location.getScheme())) {
        Map<String, Object> env = Collections.emptyMap();
        try (FileSystem fileSystem = FileSystems.newFileSystem(location, env,
                this.getClass().getClassLoader());) {
            Path path = Paths.get(location);
            try {
                // it's a directory
                return path.toFile();
            } catch (UnsupportedOperationException cause) {
                // it's a jar, we should install content
            }//from   www  .ja v  a2  s.c  om
            Files.walkFileTree(path, new TreeImporter(path, GWT_ROOT.toPath()));
            return GWT_ROOT;
        }
    }
    return Paths.get(location).toFile();
}