集册 Java实例教程 返回一个zip文件系统

返回一个zip文件系统

欢马劈雪     最近更新时间:2020-01-02 10:19:05

470
返回一个zip文件系统

/**
来 自 N o w  J a v a  . c o m
**/

//package com.nowjava;

import java.io.IOException;

import java.net.URI;

import java.nio.file.FileSystem;

import java.nio.file.FileSystems;


import java.nio.file.Path;

import java.nio.file.Paths;


import java.util.HashMap;

import java.util.Map;


public class Main {

    /**

     * Returns a zip file system

     *

     * @param zipFilename to construct the file system from

     * @param create true if the zip file should be created

     * @return a zip file system

     * @throws IOException

     */

    private static FileSystem createZipFileSystem(String zipFilename,

            boolean create) throws IOException {

        // convert the filename to a URI

        final Path path = Paths.get(zipFilename);

        final URI uri = URI.create("jar:file:" + path.toUri().getPath());


        final Map<String, String> env = new HashMap<
展开阅读全文