2013-08-07 39 views

回答

1

下面是將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);