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

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

Introduction

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

Prototype

public int getInternalAttributes() 

Source Link

Document

Retrieves the internal file attributes.

Usage

From source file:at.spardat.xma.xdelta.JarDelta.java

/**
 * Entry to new name.//from   w w  w .ja v  a2s . c o m
 *
 * @param source the source
 * @param name the name
 * @return the zip archive entry
 * @throws ZipException the zip exception
 */
public static ZipArchiveEntry entryToNewName(ZipArchiveEntry source, String name) throws ZipException {
    if (source.getName().equals(name))
        return new ZipArchiveEntry(source);
    ZipArchiveEntry ret = new ZipArchiveEntry(name);
    byte[] extra = source.getExtra();
    if (extra != null) {
        ret.setExtraFields(ExtraFieldUtils.parse(extra, true, ExtraFieldUtils.UnparseableExtraField.READ));
    } else {
        ret.setExtra(ExtraFieldUtils.mergeLocalFileDataData(source.getExtraFields(true)));
    }
    ret.setInternalAttributes(source.getInternalAttributes());
    ret.setExternalAttributes(source.getExternalAttributes());
    ret.setExtraFields(source.getExtraFields(true));
    ret.setCrc(source.getCrc());
    ret.setMethod(source.getMethod());
    ret.setSize(source.getSize());
    return ret;
}

From source file:at.spardat.xma.xdelta.JarPatcher.java

/**
 * Entry to new name.//  www  .  j a  v  a 2  s .  co m
 *
 * @param source the source
 * @param name the name
 * @return the zip archive entry
 * @throws ZipException the zip exception
 */
private ZipArchiveEntry copyEntry(ZipArchiveEntry source) throws ZipException {
    ZipArchiveEntry ret = new ZipArchiveEntry(source.getName());
    byte[] extra = source.getExtra();
    if (extra != null) {
        ret.setExtraFields(ExtraFieldUtils.parse(extra, true, ExtraFieldUtils.UnparseableExtraField.READ));
    } else {
        ret.setExtra(ExtraFieldUtils.mergeLocalFileDataData(source.getExtraFields(true)));
    }
    ret.setInternalAttributes(source.getInternalAttributes());
    ret.setExternalAttributes(source.getExternalAttributes());
    ret.setExtraFields(source.getExtraFields(true));
    return ret;
}