本文整理汇总了Java中org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setExtraFields方法的典型用法代码示例。如果您正苦于以下问题:Java ZipArchiveEntry.setExtraFields方法的具体用法?Java ZipArchiveEntry.setExtraFields怎么用?Java ZipArchiveEntry.setExtraFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.compress.archivers.zip.ZipArchiveEntry
的用法示例。
在下文中一共展示了ZipArchiveEntry.setExtraFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: entryToNewName
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; //导入方法依赖的package包/类
/**
* Entry to new name.
*
* @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;
}
示例2: setExtraFields
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; //导入方法依赖的package包/类
private static void setExtraFields(Path filePath, int fileType, ZipArchiveEntry entry) throws IOException {
if (PosixUtil.isPosixFileStore(filePath)) {
Set<PosixFilePermission> perms = Files.getPosixFilePermissions(filePath);
entry.setUnixMode(fileType | PosixUtil.getPosixPermissionsAsInt(perms));
X5455_ExtendedTimestamp x5455 = getX5455(filePath);
X7875_NewUnix x7875 = getX7875(filePath);
if (x5455 != null && x7875 != null) {
entry.setExtraFields(new ZipExtraField[] {x5455, x7875});
}
}
}
示例3: copyEntry
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; //导入方法依赖的package包/类
/**
* Entry to new name.
*
* @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;
}