Skip to content

Commit

Permalink
Support .tar.xz for ArchiveExtractor
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vowstar authored and facchinm committed Jul 18, 2019
1 parent 4e26d85 commit c88ff31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arduino-core/src/cc/arduino/utils/ArchiveExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
import org.apache.commons.compress.utils.IOUtils;
import processing.app.I18n;
import processing.app.Platform;
Expand Down Expand Up @@ -98,6 +99,8 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
in = new ZipArchiveInputStream(new FileInputStream(archiveFile));
} else if (archiveFile.getName().endsWith("tar.gz")) {
in = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(archiveFile)));
} else if (archiveFile.getName().endsWith("tar.xz")) {
in = new TarArchiveInputStream(new XZCompressorInputStream(new FileInputStream(archiveFile)));
} else if (archiveFile.getName().endsWith("tar")) {
in = new TarArchiveInputStream(new FileInputStream(archiveFile));
} else {
Expand Down

0 comments on commit c88ff31

Please sign in to comment.