public class ZipReader extends Object implements Closeable
| 构造器和说明 |
|---|
ZipReader(File zipFile,
Charset charset)
构造
|
ZipReader(InputStream in,
Charset charset)
构造
|
ZipReader(ZipFile zipFile)
构造
|
ZipReader(ZipInputStream zin)
构造
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
InputStream |
get(String path)
获取指定路径的文件流
如果是文件模式,则直接获取Entry对应的流,如果是流模式,则遍历entry后,找到对应流返回 |
static ZipReader |
of(File zipFile,
Charset charset)
创建ZipReader
|
static ZipReader |
of(InputStream in,
Charset charset)
创建ZipReader
|
ZipReader |
read(Consumer<ZipEntry> consumer)
读取并处理Zip文件中的每一个
ZipEntry |
File |
readTo(File outFile)
解压到指定目录中
|
File |
readTo(File outFile,
Filter<ZipEntry> entryFilter)
解压到指定目录中
|
public ZipReader(ZipFile zipFile)
zipFile - 读取的的Zip文件public ZipReader(InputStream in, Charset charset)
in - 读取的的Zip文件流charset - 编码public ZipReader(ZipInputStream zin)
zin - 读取的的Zip文件流public static ZipReader of(File zipFile, Charset charset)
zipFile - 生成的Zip文件charset - 编码public static ZipReader of(InputStream in, Charset charset)
in - Zip输入的流,一般为输入文件流charset - 编码public InputStream get(String path)
path - 路径public File readTo(File outFile) throws IORuntimeException
outFile - 解压到的目录IORuntimeException - IO异常public File readTo(File outFile, Filter<ZipEntry> entryFilter) throws IORuntimeException
outFile - 解压到的目录entryFilter - 过滤器,排除不需要的文件IORuntimeException - IO异常public ZipReader read(Consumer<ZipEntry> consumer) throws IORuntimeException
ZipEntryconsumer - ZipEntry处理器IORuntimeException - IO异常public void close()
throws IORuntimeException
close 在接口中 Closeableclose 在接口中 AutoCloseableIORuntimeExceptionCopyright © 2022. All rights reserved.