Code example for JarEntry

Methods: getCompressedSizegetMethodgetNamegetSizeisDirectory

0
        if (jarEntry != null)
        { 
            if (logger.isLoggable(Level.FINEST))
                logger.finest(dump(jarEntry));
 
            return NetworkUtil.download(uc.getInputStream(), jarEntry.getSize(), null);
        } 
 
        throw new IOException("JarResources.loadJarContent(" + url.toString() + ") error:\nEntry not found !");
    } 
 
    protected void setResourceContent(String name, byte content[])
    { 
        if (entryContents.containsKey(name))
        { 
            if (!collisionAllowed)
                throw new JclException("Class/Resource " + name + " already loaded");
 
            if (logger.isLoggable(Level.FINEST))
                logger.finest("Class/Resource " + name + " already loaded; ignoring entry...");
            return; 
        } 
 
        if (logger.isLoggable(Level.FINEST))
            logger.finest("Entry Name: " + name + ", " + "Entry Size: " + content.length);
 
        // add to internal resource HashMap 
        entryContents.put(name, content);
    } 
 
    /** 
     * For debugging 
     *  
     * @param je 
     * @return String 
     */ 
    private String dump(JarEntry je)
    { 
        StringBuffer sb = new StringBuffer();
        if (je.isDirectory())
            sb.append("d ");
        else 
            sb.append("f ");
 
        if (je.getMethod() == ZipEntry.STORED)
            sb.append("stored   ");
        else 
            sb.append("deflated ");
 
        sb.append(je.getName());
        sb.append("\t");
        sb.append("" + je.getSize());
        if (je.getMethod() == ZipEntry.DEFLATED)
            sb.append("/" + je.getCompressedSize());
 
        return (sb.toString());
    } 
} 
Experience pair programming with AI  Get Codota for Java