Package com.luna.common.file.compress
Class ZipReader
java.lang.Object
com.luna.common.file.compress.ZipReader
- All Implemented Interfaces:
Closeable,AutoCloseable
Zip文件或流读取器,一般用于Zip文件解压
- Since:
- 5.7.8
- Author:
- looly
-
Constructor Summary
ConstructorsConstructorDescription构造ZipReader(InputStream in, Charset charset) 构造构造ZipReader(ZipInputStream zin) 构造 -
Method Summary
-
Constructor Details
-
ZipReader
构造- Parameters:
zipFile- 读取的的Zip文件charset- 编码
-
ZipReader
构造- Parameters:
zipFile- 读取的的Zip文件
-
ZipReader
构造- Parameters:
in- 读取的的Zip文件流charset- 编码
-
ZipReader
构造- Parameters:
zin- 读取的的Zip文件流
-
-
Method Details
-
of
创建ZipReader- Parameters:
zipFile- 生成的Zip文件charset- 编码- Returns:
- ZipReader
-
of
创建ZipReader- Parameters:
in- Zip输入的流,一般为输入文件流charset- 编码- Returns:
- ZipReader
-
get
获取指定路径的文件流
如果是文件模式,则直接获取Entry对应的流,如果是流模式,则遍历entry后,找到对应流返回- Parameters:
path- 路径- Returns:
- 文件流
- Throws:
IOException
-
readTo
解压到指定目录中- Parameters:
outFile- 解压到的目录- Returns:
- 解压的目录
- Throws:
IOException- IO异常
-
readTo
解压到指定目录中- Parameters:
outFile- 解压到的目录entryFilter- 过滤器,排除不需要的文件- Returns:
- 解压的目录
- Throws:
IOException- IO异常- Since:
- 5.7.12
-
read
读取并处理Zip文件中的每一个ZipEntry- Parameters:
consumer-ZipEntry处理器- Returns:
- this
- Throws:
IOException- IO异常
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-