Code example for ZipFile

Methods: getEntry, getInputStream

0
 
    public static Jbi readDescriptor(File file) {
        Jbi result = null;
        try { 
 
            final ZipFile zipFile = new ZipFile(file);
            final ZipEntry jbiDescriptorZipEntry = zipFile.getEntry("META-INF/jbi.xml");
            final InputStream jbiDescriptorInputStream = zipFile
                    .getInputStream(jbiDescriptorZipEntry);
 
            // Load the JBI descriptor 
            result = JBIDescriptorBuilder.buildJavaJBIDescriptor(jbiDescriptorInputStream);
 
        } catch (JBIDescriptorException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } 
 
        return result;
    }