java 复制,删除,从存档中删除文件并解压缩

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 复制,删除,从存档中删除文件并解压缩相关的知识,希望对你有一定的参考价值。

Map<String, String> zip_properties = new HashMap<>();
/* We want to read an existing ZIP File, so we set this to False */
zip_properties.put("create", "false");

/* Specify the path to the ZIP File that you want to read as a File System */
URI zip_disk = URI.create("jar:file:/D:/kms-trunk/KMS-Installer/build/distributions/KMS-Installer-6.0.jar");

/* Create ZIP file System */
try (FileSystem zipfs = FileSystems.newFileSystem(zip_disk, zip_properties)) {
    /* Get the Path inside ZIP File to copy the ZIP Entry */
    Path pathInZipfile = zipfs.getPath("server.kms.xml");
    System.out.println("About to copy an entry from ZIP File" + pathInZipfile.toUri());
    /* Execute Delete */
    Files.copy(pathInZipfile, Paths.get("C:\\Users\\IvanBelorechev\\Downloads\\server.kms.xml.my"));
    System.out.println("File successfully copied");
}

以上是关于java 复制,删除,从存档中删除文件并解压缩的主要内容,如果未能解决你的问题,请参考以下文章