Code example for JarFile

Methods: close, getEntry, getInputStream

0
        } 
 
        if (docBuilder != null) {
            JarFile jf = null;
            try { 
                jf = new JarFile(zipFile);
                JarEntry je = (JarEntry) jf.getEntry("META-INF/jbi.xml"); // NOI18N
                if (je != null) {
                    InputStream is = jf.getInputStream(je);
                    Document doc = docBuilder.parse(is);
                    isRightType = validate(doc); // very basic type checking
                } 
            } catch (Exception e) {
                e.printStackTrace();
            } finally { 
                if (jf != null) {
                    try { 
                        jf.close();
                    } catch (IOException e) {
                    } 
                } 
            } 
        }