public class CompressUtil extends Object
Constructor and Description |
---|
CompressUtil() |
Modifier and Type | Method and Description |
---|---|
static Archiver |
createArchiver(Charset charset,
String archiverName,
File file)
创建归档器,支持:
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
|
static Archiver |
createArchiver(Charset charset,
String archiverName,
OutputStream out)
创建归档器,支持:
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
|
static Extractor |
createExtractor(Charset charset,
File file)
创建归档解包器,支持:
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
|
static Extractor |
createExtractor(Charset charset,
InputStream in)
创建归档解包器,支持:
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
|
static Extractor |
createExtractor(Charset charset,
String archiverName,
File file)
创建归档解包器,支持:
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
|
static Extractor |
createExtractor(Charset charset,
String archiverName,
InputStream in)
创建归档解包器,支持:
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
|
static org.apache.commons.compress.compressors.CompressorInputStream |
getIn(String compressorName,
InputStream in)
获取压缩输入流,用于解压缩指定内容,支持的格式例如:
|
static org.apache.commons.compress.compressors.CompressorOutputStream |
getOut(String compressorName,
OutputStream out)
获取压缩输出流,用于压缩指定内容,支持的格式例如:
|
public static org.apache.commons.compress.compressors.CompressorOutputStream getOut(String compressorName, OutputStream out)
compressorName
- 压缩名称,见:CompressorStreamFactory
out
- 输出流,可以输出到内存、网络或文件CompressorOutputStream
public static org.apache.commons.compress.compressors.CompressorInputStream getIn(String compressorName, InputStream in)
compressorName
- 压缩名称,见:CompressorStreamFactory
,null表示自动检测in
- 输出流,可以输出到内存、网络或文件CompressorOutputStream
public static Archiver createArchiver(Charset charset, String archiverName, File file)
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
charset
- 编码archiverName
- 归档类型名称,见ArchiveStreamFactory
file
- 归档输出的文件public static Archiver createArchiver(Charset charset, String archiverName, OutputStream out)
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
charset
- 编码archiverName
- 归档类型名称,见ArchiveStreamFactory
out
- 归档输出的流public static Extractor createExtractor(Charset charset, File file)
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
charset
- 编码,7z格式此参数无效file
- 归档文件Extractor
public static Extractor createExtractor(Charset charset, String archiverName, File file)
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
charset
- 编码,7z格式此参数无效archiverName
- 归档类型名称,见ArchiveStreamFactory
,null表示自动识别file
- 归档文件Extractor
public static Extractor createExtractor(Charset charset, InputStream in)
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
charset
- 编码,7z格式此参数无效in
- 归档输入的流Extractor
public static Extractor createExtractor(Charset charset, String archiverName, InputStream in)
ArchiveStreamFactory.AR
ArchiveStreamFactory.CPIO
ArchiveStreamFactory.JAR
ArchiveStreamFactory.TAR
ArchiveStreamFactory.ZIP
ArchiveStreamFactory.SEVEN_Z
charset
- 编码,7z格式此参数无效archiverName
- 归档类型名称,见ArchiveStreamFactory
,null表示自动识别in
- 归档输入的流Extractor
Copyright © 2024. All rights reserved.