Code example for ZipFile

Methods: getEntrygetInputStream

0
    public void metadataExtractionTest() throws AnalysisException, JDOMException, IOException, SAXException, TransformationException, URISyntaxException { 
        InputStream testStream = this.getClass().getResourceAsStream(TEST_FILE);
        BxDocument testDocument = extractor.extractStructure(testStream);
         
        URL url = this.getClass().getResource(EXP_ZIP_FILE);
        ZipFile zipFile = new ZipFile(new File(url.toURI()));
        InputStream inputStream = zipFile.getInputStream(zipFile.getEntry(EXP_FILE));
        BxDocument expDocument = new BxDocument().setPages(reader.read(new InputStreamReader(inputStream)));
         
        assertTrue(BxModelUtils.areEqual(expDocument, testDocument));
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE