[英]Random access zip file using java.util.zip
我可以知道如何隨機訪問一個zip文件並解壓縮ZipEntry嗎?
基本上,我已經知道我希望從zip文件中獲取的文件,並且不希望將其解壓縮。
這是將zip條目作為流獲取的示例(ZipFile.getInputStream(entry));
ZipEntry entry = zipFile.getEntry(entryName);
InputStream xmlInStream = zipFile.getInputStream(entry);
//process the stream- below one is for xml parsing.
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
return documentBuilder.parse(xmlInStream);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.