Here you can find the source of createZipFileSystem(Path path)
Parameter | Description |
---|---|
path | the path to the file |
Parameter | Description |
---|---|
IOException | an exception |
public static Path createZipFileSystem(Path path) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; public class Main { /**/*from w ww . j a v a2s . c om*/ * Create a zip file system and returns back the root * * @param path the path to the file * @return the root of the new file system * @throws IOException */ public static Path createZipFileSystem(Path path) throws IOException { Map<String, String> env = new HashMap<>(); if (!Files.exists(path)) { env.put("create", "true"); } URI uri = URI.create("jar:file:" + path.toUri().getPath()); FileSystem fileSystem = FileSystems.newFileSystem(uri, env, null); return fileSystem.getPath("/"); } }