Skip to content

Commit c88ff31

Browse files
vowstarfacchinm
authored andcommitted
Support .tar.xz for ArchiveExtractor
Now ```tar.xz``` format is widely used, and the official arduino IDE download URL also shows that arduino uses ```tar.xz``` format. (https://downloads.arduino.cc/arduino-1.8.9-linux64.tar.xz). As we all know, the tar.xz format has the optimal size compared to tar, tar.gz, tar.bz2, and zip. (https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison/) Therefore, it is very unreasonable not to support tar.xz. Supporting this format can save almost half of the bandwidth resources and download time when compressing the gcc toolchain, making users more comfortable. Signed-off-by: Huang Rui <vowstar@gmail.com>
1 parent 4e26d85 commit c88ff31

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arduino-core/src/cc/arduino/utils/ArchiveExtractor.java

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
3737
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
3838
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
39+
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
3940
import org.apache.commons.compress.utils.IOUtils;
4041
import processing.app.I18n;
4142
import processing.app.Platform;
@@ -98,6 +99,8 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
9899
in = new ZipArchiveInputStream(new FileInputStream(archiveFile));
99100
} else if (archiveFile.getName().endsWith("tar.gz")) {
100101
in = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(archiveFile)));
102+
} else if (archiveFile.getName().endsWith("tar.xz")) {
103+
in = new TarArchiveInputStream(new XZCompressorInputStream(new FileInputStream(archiveFile)));
101104
} else if (archiveFile.getName().endsWith("tar")) {
102105
in = new TarArchiveInputStream(new FileInputStream(archiveFile));
103106
} else {

0 commit comments

Comments
 (0)