Example usage for org.apache.commons.compress.archivers.zip ZipArchiveEntry setSize

List of usage examples for org.apache.commons.compress.archivers.zip ZipArchiveEntry setSize

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers.zip ZipArchiveEntry setSize.

Prototype

public void setSize(long size) 

Source Link

Document

Sets the uncompressed size of the entry data.

Usage

From source file:org.waarp.common.tar.ZipUtility.java

/**
 * Recursive traversal to add files/* w  ww . j  av a2s .co  m*/
 * 
 * @param file
 * @param zaos
 * @throws IOException
 */
private static void addFile(File file, ZipArchiveOutputStream zaos) throws IOException {
    String filename = null;
    filename = file.getName();
    ZipArchiveEntry zae = new ZipArchiveEntry(filename);
    zae.setSize(file.length());
    zaos.putArchiveEntry(zae);
    FileInputStream fis = new FileInputStream(file);
    IOUtils.copy(fis, zaos);
    zaos.closeArchiveEntry();
}