Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含大量文件的文件夹.zip。我想征用这些文件并递归读取压缩.xml文件。我将如何首先征用这些.zip文件?我根本不知道。
.zip
.xml
为您的目录创建一个对象,并使用适合您的 zip 文件的过滤器File调用其方法。listFiles
File
listFiles
ZipFile为每个 zipfile构造一个对象并调用其entries()方法以获取条目列表。找到所需ZipEntry的 XML 文件并调用ZipFile.getInputstream(xmlZipFileEntry)以开始读取其内容。
ZipFile
entries()
ZipEntry
ZipFile.getInputstream(xmlZipFileEntry)