public abstract class ZipUtils extends Object
| Constructor and Description |
|---|
ZipUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
toZip(List<File> srcFiles,
OutputStream out,
boolean keepDirStructure,
String pathInZip)
压缩成ZIP 方法2
|
static void |
toZip(String srcDir,
OutputStream out,
boolean keepDirStructure,
String pathInZip)
压缩成ZIP 方法1
|
public static void toZip(String srcDir, OutputStream out, boolean keepDirStructure, String pathInZip) throws IOException
srcDir - 压缩文件夹路径out - 压缩文件输出流keepDirStructure - 是否保留原来的目录结构pathInZip - 当 keepDirStructure = false时,所有文件在压缩包中存放的目录名IOException - 压缩失败会抛出运行时异常public static void toZip(List<File> srcFiles, OutputStream out, boolean keepDirStructure, String pathInZip) throws IOException
srcFiles - 需要压缩的文件列表out - 压缩文件输出流keepDirStructure - 是否保留原来的目录结构pathInZip - 当 keepDirStructure = false时,所有文件在压缩包中存放的目录名IOException - 压缩失败会抛出运行时异常Copyright © 2021–2022 EasyJ开源社区. All rights reserved.