Example usage for org.apache.commons.compress.archivers.zip ZipArchiveOutputStream write

List of usage examples for org.apache.commons.compress.archivers.zip ZipArchiveOutputStream write

Introduction

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

Prototype

public void write(byte[] b, int offset, int length) throws IOException 

Source Link

Document

Writes bytes to ZIP entry.

Usage

From source file:org.springframework.boot.gradle.tasks.bundling.BootZipCopyAction.java

private void writeClass(ZipArchiveEntry entry, ZipInputStream in, ZipArchiveOutputStream out)
        throws IOException {
    prepareEntry(entry, UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM);
    out.putArchiveEntry(entry);//from  w ww .j  av  a2s . co  m
    byte[] buffer = new byte[4096];
    int read;
    while ((read = in.read(buffer)) > 0) {
        out.write(buffer, 0, read);
    }
    out.closeArchiveEntry();
}