代码如下:
ZipOutputStream zipOut = new ZipOutputStream(byteOutPutStream);
// 使用指定名称创建新的 ZIP 条目
ZipEntry zipEntry = new ZipEntry(value.get("fileName"));
代码本身是没有问题的,在使用zipEntry时出现文件名是中文时的乱码不怪代码,只需将ZipEntry换成阿帕奇的就可以了:
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;