更改 ZipEntry 的权限 [英] Change permission of a ZipEntry

查看:37
本文介绍了更改 ZipEntry 的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 java.util.zip API 生成一个 zip 文件,但我没有找到任何方法来设置 ZipEntry.有想法吗?

I'm trying to generate a zip file with java.util.zip API and I haven't found any way to set permissions of a ZipEntry. An idea?

推荐答案

使用 java.util.zip 是不可能的.试试 Apache commons-compress.具体来说,你想调用 setModeAsiExtraField,然后将其添加到 ZipArchiveEntry 放在 ZipArchiveOutputStream.

It's not possible using java.util.zip. Try Apache commons-compress. Specifically, you want to call setMode on an AsiExtraField, and then add that to a ZipArchiveEntry that you put in a ZipArchiveOutputStream.

这篇关于更改 ZipEntry 的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆