v0.0.4
CI/CD / build-deploy (pull_request) Failing after 10s

This commit is contained in:
Timi
2026-04-07 16:52:13 +08:00
parent 01c21c7aa0
commit 829c7f0184
15 changed files with 89 additions and 89 deletions
@@ -58,8 +58,8 @@ public enum CompressType {
* @return 压缩操作对象
* @throws Exception 实例化失败
*/
public Compressor<?> ofCompress(String fromPath) throws Exception {
return getCompressor().from(fromPath);
public Compressor<?> compressFrom(String fromPath) throws Exception {
return getCompressor().of(fromPath);
}
/**
@@ -69,8 +69,8 @@ public enum CompressType {
* @return 压缩操作对象
* @throws Exception 实例化失败
*/
public Compressor<?> ofCompress(File fromFile) throws Exception {
return getCompressor().from(fromFile);
public Compressor<?> compressFrom(File fromFile) throws Exception {
return getCompressor().of(fromFile);
}
/**
@@ -90,8 +90,8 @@ public enum CompressType {
* @return 解压操作对象
* @throws Exception 实例化失败
*/
public Decompressor<?> ofCompressed(File fromFile) throws Exception {
return getDecompressor().from(fromFile);
public Decompressor<?> decompressedFrom(File fromFile) throws Exception {
return getDecompressor().of(fromFile);
}
/**
@@ -101,8 +101,8 @@ public enum CompressType {
* @return 解压操作对象
* @throws Exception 实例化失败
*/
public Decompressor<?> ofCompressed(InputStream fromStream) throws Exception {
return getDecompressor().from(fromStream);
public Decompressor<?> decompressedFrom(InputStream fromStream) throws Exception {
return getDecompressor().of(fromStream);
}
/**
@@ -114,7 +114,7 @@ public enum CompressType {
* @throws UnsupportedOperationException 不支持的文件
* @throws Exception 实例化失败
*/
public static Decompressor<?> fromFile(File file) throws Exception {
public static Decompressor<?> from(File file) throws Exception {
try (InputStream inputStream = IO.getInputStream(file)) {
byte[] head = new byte[512];
int length = inputStream.read(head);
@@ -122,16 +122,16 @@ public enum CompressType {
throw new UnsupportedOperationException("empty file");
}
if (SevenZFile.matches(head, length)) {
return Z7.ofCompressed(file);
return Z7.decompressedFrom(file);
}
if (ZipArchiveInputStream.matches(head, length)) {
return ZIP.ofCompressed(file);
return ZIP.decompressedFrom(file);
}
if (GzipCompressorInputStream.matches(head, length)) {
return GZIP.ofCompressed(file);
return GZIP.decompressedFrom(file);
}
if (TarArchiveInputStream.matches(head, length)) {
return TAR.ofCompressed(file);
return TAR.decompressedFrom(file);
}
}
throw new UnsupportedOperationException("not support file");
@@ -24,7 +24,7 @@ public abstract class Compressor<T extends Compressor<T>> extends AbstractRunner
* @param fromPath 源路径
* @return 当前压缩器
*/
public T from(String fromPath) {
protected T of(String fromPath) {
TimiException.required(fromPath, "not found fromPath");
this.fromPath = fromPath;
return self();
@@ -36,9 +36,9 @@ public abstract class Compressor<T extends Compressor<T>> extends AbstractRunner
* @param fromFile 源文件
* @return 当前压缩器
*/
public T from(File fromFile) {
protected T of(File fromFile) {
TimiException.required(fromFile, "not found fromFile");
return from(fromFile.getAbsolutePath());
return of(fromFile.getAbsolutePath());
}
/**
@@ -27,7 +27,7 @@ public abstract class Decompressor<T extends Decompressor<T>> extends AbstractRu
* @param fromFile 源压缩文件
* @return 当前解压器
*/
public T from(File fromFile) {
protected T of(File fromFile) {
TimiException.required(fromFile, "not found fromFile");
this.fromFile = fromFile;
this.fromStream = null;
@@ -40,9 +40,9 @@ public abstract class Decompressor<T extends Decompressor<T>> extends AbstractRu
* @param fromPath 源压缩文件路径
* @return 当前解压器
*/
public T from(String fromPath) {
protected T of(String fromPath) {
TimiException.required(fromPath, "not found fromPath");
return from(new File(fromPath));
return of(new File(fromPath));
}
/**
@@ -51,7 +51,7 @@ public abstract class Decompressor<T extends Decompressor<T>> extends AbstractRu
* @param fromStream 源压缩输入流
* @return 当前解压器
*/
public T from(InputStream fromStream) {
public T of(InputStream fromStream) {
TimiException.required(fromStream, "not found fromStream");
this.fromStream = fromStream;
this.fromFile = null;
@@ -26,8 +26,8 @@ public class GZipCompressor extends Compressor<GZipCompressor> {
* @param fromPath 源路径
* @return 压缩器
*/
public static GZipCompressor of(String fromPath) {
return new GZipCompressor().from(fromPath);
public static GZipCompressor from(String fromPath) {
return new GZipCompressor().of(fromPath);
}
/**
@@ -36,8 +36,8 @@ public class GZipCompressor extends Compressor<GZipCompressor> {
* @param fromFile 源文件
* @return 压缩器
*/
public static GZipCompressor of(File fromFile) {
return new GZipCompressor().from(fromFile);
public static GZipCompressor from(File fromFile) {
return new GZipCompressor().of(fromFile);
}
@Override
@@ -23,8 +23,8 @@ public class GZipDecompressor extends Decompressor<GZipDecompressor> {
* @param fromFile 源压缩文件
* @return 解压器
*/
public static GZipDecompressor of(File fromFile) {
return new GZipDecompressor().from(fromFile);
public static GZipDecompressor from(File fromFile) {
return new GZipDecompressor().of(fromFile);
}
/**
@@ -33,8 +33,8 @@ public class GZipDecompressor extends Decompressor<GZipDecompressor> {
* @param fromPath 源压缩文件路径
* @return 解压器
*/
public static GZipDecompressor of(String fromPath) {
return new GZipDecompressor().from(fromPath);
public static GZipDecompressor from(String fromPath) {
return new GZipDecompressor().of(fromPath);
}
/**
@@ -43,8 +43,8 @@ public class GZipDecompressor extends Decompressor<GZipDecompressor> {
* @param fromStream 源压缩输入流
* @return 解压器
*/
public static GZipDecompressor of(InputStream fromStream) {
return new GZipDecompressor().from(fromStream);
public static GZipDecompressor from(InputStream fromStream) {
return new GZipDecompressor().of(fromStream);
}
@Override
@@ -24,8 +24,8 @@ public class TarCompressor extends Compressor<TarCompressor> {
* @param fromPath 源路径
* @return 压缩器
*/
public static TarCompressor of(String fromPath) {
return new TarCompressor().from(fromPath);
public static TarCompressor from(String fromPath) {
return new TarCompressor().of(fromPath);
}
/**
@@ -34,8 +34,8 @@ public class TarCompressor extends Compressor<TarCompressor> {
* @param fromFile 源文件
* @return 压缩器
*/
public static TarCompressor of(File fromFile) {
return new TarCompressor().from(fromFile);
public static TarCompressor from(File fromFile) {
return new TarCompressor().of(fromFile);
}
@Override
@@ -22,8 +22,8 @@ public class TarDecompressor extends Decompressor<TarDecompressor> {
* @param fromFile 源压缩文件
* @return 解压器
*/
public static TarDecompressor of(File fromFile) {
return new TarDecompressor().from(fromFile);
public static TarDecompressor from(File fromFile) {
return new TarDecompressor().of(fromFile);
}
/**
@@ -32,8 +32,8 @@ public class TarDecompressor extends Decompressor<TarDecompressor> {
* @param fromPath 源压缩文件路径
* @return 解压器
*/
public static TarDecompressor of(String fromPath) {
return new TarDecompressor().from(fromPath);
public static TarDecompressor from(String fromPath) {
return new TarDecompressor().of(fromPath);
}
/**
@@ -42,8 +42,8 @@ public class TarDecompressor extends Decompressor<TarDecompressor> {
* @param fromStream 源压缩输入流
* @return 解压器
*/
public static TarDecompressor of(InputStream fromStream) {
return new TarDecompressor().from(fromStream);
public static TarDecompressor from(InputStream fromStream) {
return new TarDecompressor().of(fromStream);
}
@Override
@@ -25,8 +25,8 @@ public class Z7Compressor extends Compressor<Z7Compressor> {
* @param fromPath 源路径
* @return 压缩器
*/
public static Z7Compressor of(String fromPath) {
return new Z7Compressor().from(fromPath);
public static Z7Compressor from(String fromPath) {
return new Z7Compressor().of(fromPath);
}
/**
@@ -35,15 +35,15 @@ public class Z7Compressor extends Compressor<Z7Compressor> {
* @param fromFile 源文件
* @return 压缩器
*/
public static Z7Compressor of(File fromFile) {
return new Z7Compressor().from(fromFile);
public static Z7Compressor from(File fromFile) {
return new Z7Compressor().of(fromFile);
}
@Override
protected void toStream(String fromPath, OutputStream toStream) throws Exception {
Path tempFile = Files.createTempFile("timi-compress-", ".7z");
try {
from(fromPath).toFile(tempFile.toFile());
of(fromPath).toFile(tempFile.toFile());
try (InputStream inputStream = Files.newInputStream(tempFile)) {
transfer(inputStream, toStream, false);
toStream.flush();
@@ -24,8 +24,8 @@ public class Z7Decompressor extends Decompressor<Z7Decompressor> {
* @param fromFile 源压缩文件
* @return 解压器
*/
public static Z7Decompressor of(File fromFile) {
return new Z7Decompressor().from(fromFile);
public static Z7Decompressor from(File fromFile) {
return new Z7Decompressor().of(fromFile);
}
/**
@@ -34,8 +34,8 @@ public class Z7Decompressor extends Decompressor<Z7Decompressor> {
* @param fromPath 源压缩文件路径
* @return 解压器
*/
public static Z7Decompressor of(String fromPath) {
return new Z7Decompressor().from(fromPath);
public static Z7Decompressor from(String fromPath) {
return new Z7Decompressor().of(fromPath);
}
/**
@@ -44,8 +44,8 @@ public class Z7Decompressor extends Decompressor<Z7Decompressor> {
* @param fromStream 源压缩输入流
* @return 解压器
*/
public static Z7Decompressor of(InputStream fromStream) {
return new Z7Decompressor().from(fromStream);
public static Z7Decompressor from(InputStream fromStream) {
return new Z7Decompressor().of(fromStream);
}
@Override
@@ -24,8 +24,8 @@ public class ZipCompressor extends Compressor<ZipCompressor> {
* @param fromPath 源路径
* @return 压缩器
*/
public static ZipCompressor of(String fromPath) {
return new ZipCompressor().from(fromPath);
public static ZipCompressor from(String fromPath) {
return new ZipCompressor().of(fromPath);
}
/**
@@ -34,8 +34,8 @@ public class ZipCompressor extends Compressor<ZipCompressor> {
* @param fromFile 源文件
* @return 压缩器
*/
public static ZipCompressor of(File fromFile) {
return new ZipCompressor().from(fromFile);
public static ZipCompressor from(File fromFile) {
return new ZipCompressor().of(fromFile);
}
@Override
@@ -24,8 +24,8 @@ public class ZipDecompressor extends Decompressor<ZipDecompressor> {
* @param fromFile 源压缩文件
* @return 解压器
*/
public static ZipDecompressor of(File fromFile) {
return new ZipDecompressor().from(fromFile);
public static ZipDecompressor from(File fromFile) {
return new ZipDecompressor().of(fromFile);
}
/**
@@ -34,8 +34,8 @@ public class ZipDecompressor extends Decompressor<ZipDecompressor> {
* @param fromPath 源压缩文件路径
* @return 解压器
*/
public static ZipDecompressor of(String fromPath) {
return new ZipDecompressor().from(fromPath);
public static ZipDecompressor from(String fromPath) {
return new ZipDecompressor().of(fromPath);
}
/**
@@ -44,8 +44,8 @@ public class ZipDecompressor extends Decompressor<ZipDecompressor> {
* @param fromStream 源压缩输入流
* @return 解压器
*/
public static ZipDecompressor of(InputStream fromStream) {
return new ZipDecompressor().from(fromStream);
public static ZipDecompressor from(InputStream fromStream) {
return new ZipDecompressor().of(fromStream);
}
@Override