Code example for JarEntry

Methods: getNamegetSize

0
    JarEntry e = jar.getJarEntry(pn);
 
    if (e != null) {
      InputStream is = null;
      try { 
        long len = e.getSize();
        if (len > Integer.MAX_VALUE) {
          error("classfile too big: " + e.getName());
        } 
 
        is = jar.getInputStream(e);
 
        byte[] data = new byte[(int) len];
        readFully(is, data);
 
        return data;
 
      } catch (IOException iox) {
        error("error reading jar entry " + e.getName());
 
      } finally { 
        if (is != null) {
          try { 
            is.close();
          } catch (IOException iox) {
            error("cannot close input stream for file " + e.getName());
          } 
        } 
      } 
    } 
 
Experience pair programming with AI  Get Codota for Java