Example usage for org.apache.commons.compress.archivers.zip ZipArchiveInputStream ZipArchiveInputStream

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

Introduction

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

Prototype

public ZipArchiveInputStream(InputStream inputStream, String encoding, boolean useUnicodeExtraFields) 

Source Link

Usage

From source file:org.xwiki.xar.XarPackage.java

/**
 * Find and add the entries located in the passed XAR file.
 * //from w  ww.j av  a  2  s . c  o m
 * @param xarStream an input stream to a XAR file
 * @throws IOException when failing to read the file
 * @throws XarException when failing to parse the XAR package
 */
public void read(InputStream xarStream) throws IOException, XarException {
    ZipArchiveInputStream zis = new ZipArchiveInputStream(xarStream, "UTF-8", false);

    try {
        for (ZipArchiveEntry entry = zis.getNextZipEntry(); entry != null; entry = zis.getNextZipEntry()) {
            if (!entry.isDirectory() && zis.canReadEntryData(entry)) {
                readEntry(zis, entry);
            }
        }
    } finally {
        zis.close();
    }
}