Code example for ZipEntry

Methods: getCompressedSizegetMethodgetNamegetSize

0
     */ 
    private StringBuffer createZipDetails( ZipEntry e ) {
 
        StringBuffer sb = new StringBuffer();
 
        sb.append( "added " + e.getName() );
 
        if ( e.getMethod() == ZipEntry.DEFLATED ) {
            long size = e.getSize();
 
            if ( size > 0 ) {
                long csize = e.getCompressedSize();
                long ratio = ( ( size - csize ) * 100 ) / size;
                sb.append( " (deflated " + ratio + "%)" );
            } else { 
                sb.append( " (deflated 0%)" );
            } 
        } else { 
            sb.append( " (stored 0%)" );
        } 
Stop searching for code, let great code find you!  Add Codota to your java IDE