v0.0.4
Some checks failed
CI/CD / build-deploy (pull_request) Failing after 12s

This commit is contained in:
Timi
2026-04-07 16:44:18 +08:00
parent b56f4e8969
commit 01c21c7aa0
3 changed files with 15 additions and 9 deletions

View File

@@ -46,10 +46,10 @@ public class GZipCompressor extends Compressor<GZipCompressor> {
List<File> files = IO.listFile(fromFile);
String basePath = files.getFirst().getParentFile().getAbsolutePath();
initByteProgress(IO.calcSize(fromFile));
try (
GzipCompressorOutputStream gzipOutputStream = new GzipCompressorOutputStream(new BufferedOutputStream(nonClosing(toStream)));
TarArchiveOutputStream tarOutputStream = new TarArchiveOutputStream(gzipOutputStream)
) {
GzipCompressorOutputStream gzipOutputStream = new GzipCompressorOutputStream(new BufferedOutputStream(nonClosing(toStream)));
TarArchiveOutputStream tarOutputStream = null;
try {
tarOutputStream = new TarArchiveOutputStream(gzipOutputStream);
for (File sourceFile : files) {
String name = sourceFile.getAbsolutePath().substring(basePath.length() + 1);
TarArchiveEntry tarEntry = new TarArchiveEntry(sourceFile, normalizeEntryName(name));
@@ -61,9 +61,13 @@ public class GZipCompressor extends Compressor<GZipCompressor> {
handleFile(sourceFile);
}
tarOutputStream.finish();
gzipOutputStream.finish();
finishProgress();
} finally {
if (tarOutputStream != null) {
tarOutputStream.close();
} else {
gzipOutputStream.close();
}
resetProgress();
}
}