简体   繁体   English

在Java中的ZIP文件中获取目录的内容

[英]Get contents of a directory in a ZIP file in Java

I have some default configuration files inside my application jar that I would like to save to the file system if they don't already exist. 我的应用程序jar中有一些默认配置文件,如果它们不存在,我想保存到文件系统。 I would like it to keep the directory structure too. 我也希望保留目录结构。 Example: 例:

Jar file
-configs/
    -main-config.cfg
    -another-file.txt
    -stuff/
        -another-file.cfg
-com/
-META-INF/

I would like the contents of configs/ to be mirrored to the file system, including the subfolder. 我希望将configs /的内容镜像到文件系统,包括子文件夹。

使用JarFile.entries可以获取Jar文件中所有条目的枚举。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM