Class SevenZExtractor
java.lang.Object
org.miaixz.bus.extra.compress.extractor.SevenZExtractor
- All Implemented Interfaces:
Closeable,AutoCloseable,RandomAccess,Extractor
7z格式数据解压器,即将归档打包的数据释放
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionSevenZExtractor(File file) 构造SevenZExtractor(File file, char[] password) 构造构造SevenZExtractor(InputStream in, char[] password) 构造SevenZExtractor(SeekableByteChannel channel) 构造SevenZExtractor(SeekableByteChannel channel, char[] password) 构造 -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()无异常关闭void释放(解压)到指定目录,结束后自动关闭流,此方法只能调用一次获取满足指定过滤要求的压缩包内的第一个文件流
-
Constructor Details
-
SevenZExtractor
构造- Parameters:
file- 包文件
-
SevenZExtractor
构造- Parameters:
file- 包文件password- 密码,null表示无密码
-
SevenZExtractor
构造- Parameters:
in- 包流
-
SevenZExtractor
构造- Parameters:
in- 包流password- 密码,null表示无密码
-
SevenZExtractor
构造- Parameters:
channel-SeekableByteChannel
-
SevenZExtractor
构造- Parameters:
channel-SeekableByteChannelpassword- 密码,null表示无密码
-
-
Method Details
-
extract
public void extract(File targetDir, Predicate<org.apache.commons.compress.archivers.ArchiveEntry> predicate) Description copied from interface:Extractor释放(解压)到指定目录,结束后自动关闭流,此方法只能调用一次- Specified by:
extractin interfaceExtractor- Parameters:
targetDir- 目标目录predicate- 解压文件过滤器,用于指定需要释放的文件,null表示不过滤。Predicate.test(Object)为true时释放。
-
getFirst
public InputStream getFirst(Predicate<org.apache.commons.compress.archivers.ArchiveEntry> predicate) Description copied from interface:Extractor获取满足指定过滤要求的压缩包内的第一个文件流- Specified by:
getFirstin interfaceExtractor- Parameters:
predicate- 用于指定需要释放的文件,null表示不过滤。当Predicate.test(Object)为true返回对应流。- Returns:
- 满足过滤要求的第一个文件的流, 无满足条件的文件返回
null
-
close
public void close()Description copied from interface:Extractor无异常关闭
-