v0.0.1
Some checks failed
CI/CD / build-deploy (pull_request) Failing after 1m31s

This commit is contained in:
Timi
2026-04-01 14:09:24 +08:00
parent 47f1c9520e
commit afcc902cbf
20 changed files with 986 additions and 396 deletions

View File

@@ -1,21 +1,38 @@
package com.imyeyu.compress;
import com.imyeyu.io.IO;
import java.io.File;
import java.io.InputStream;
/**
* 抽象解压
* 抽象解压
*
* @author 夜雨
* @version 2024-06-30 18:02
*/
public abstract class Decompressor extends AbstractCompressor {
public abstract class Decompressor extends AbstractRunner {
/**
* 执行解压
* 将压缩文件解压到目标目录
*
* @param fromFile 源压缩文件
* @param toPath 解压路径
* @param fromFile 源压缩文件
* @param toPath 目标目录
* @throws Exception 解压失败
*/
public abstract void run(File fromFile, String toPath) throws Exception;
public void run(File fromFile, String toPath) throws Exception {
try (InputStream inputStream = IO.getInputStream(fromFile)) {
run(inputStream, toPath);
}
}
/**
* 将压缩输入流解压到目标目录
* 输入流由调用方管理
*
* @param fromStream 源压缩输入流
* @param toPath 目标目录
* @throws Exception 解压失败
*/
public abstract void run(InputStream fromStream, String toPath) throws Exception;
}