mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
9fec53f8f2
commit
2495825c74
@ -91,22 +91,22 @@ public class StreamArchiver implements Archiver {
|
|||||||
* @param targetStream 归档输出的流
|
* @param targetStream 归档输出的流
|
||||||
*/
|
*/
|
||||||
public StreamArchiver(final Charset charset, final String archiverName, final OutputStream targetStream) {
|
public StreamArchiver(final Charset charset, final String archiverName, final OutputStream targetStream) {
|
||||||
if("tgz".equalsIgnoreCase(archiverName) || "tar.gz".equalsIgnoreCase(archiverName)){
|
if ("tgz".equalsIgnoreCase(archiverName) || "tar.gz".equalsIgnoreCase(archiverName)) {
|
||||||
//issue#I5J33E,支持tgz格式解压
|
//issue#I5J33E,支持tgz格式解压
|
||||||
try {
|
try {
|
||||||
this.out = new TarArchiveOutputStream(new GzipCompressorOutputStream(targetStream));
|
this.out = new TarArchiveOutputStream(new GzipCompressorOutputStream(targetStream));
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new IORuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
return;
|
} else {
|
||||||
|
final ArchiveStreamFactory factory = new ArchiveStreamFactory(charset.name());
|
||||||
|
try {
|
||||||
|
this.out = factory.createArchiveOutputStream(archiverName, targetStream);
|
||||||
|
} catch (final ArchiveException e) {
|
||||||
|
throw new CompressException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArchiveStreamFactory factory = new ArchiveStreamFactory(charset.name());
|
|
||||||
try {
|
|
||||||
this.out = factory.createArchiveOutputStream(archiverName, targetStream);
|
|
||||||
} catch (final ArchiveException e) {
|
|
||||||
throw new CompressException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
//特殊设置
|
//特殊设置
|
||||||
if (this.out instanceof TarArchiveOutputStream) {
|
if (this.out instanceof TarArchiveOutputStream) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user