21
21
import org .apache .commons .compress .archivers .zip .ZipArchiveInputStream ;
22
22
import org .apache .commons .compress .compressors .bzip2 .BZip2CompressorInputStream ;
23
23
import org .apache .commons .compress .compressors .gzip .GzipCompressorInputStream ;
24
+ import org .apache .commons .compress .compressors .zstandard .ZstdCompressorInputStream ;
24
25
import org .apache .commons .io .FileUtils ;
25
26
import org .eclipse .core .runtime .IPath ;
26
27
import org .eclipse .core .runtime .IProgressMonitor ;
@@ -79,27 +80,34 @@ private static IStatus processArchive(String pArchiveFileName, IPath pInstallPat
79
80
// Create an ArchiveInputStream with the correct archiving algorithm
80
81
String faileToExtractMessage = Messages .Manager_Failed_to_extract .replace (FILE , pArchiveFullFileName );
81
82
if (pArchiveFileName .endsWith ("tar.bz2" )) { //$NON-NLS-1$
82
- try (ArchiveInputStream inStream = new TarArchiveInputStream (
83
+ try (TarArchiveInputStream inStream = new TarArchiveInputStream (
83
84
new BZip2CompressorInputStream (new FileInputStream (pArchiveFullFileName )))) {
84
85
return extract (inStream , pInstallPath .toFile (), 1 , pForceDownload , pMonitor );
85
86
} catch (IOException | InterruptedException e ) {
86
87
return new Status (IStatus .ERROR , Activator .getId (), faileToExtractMessage , e );
87
88
}
88
89
} else if (pArchiveFileName .endsWith ("zip" )) { //$NON-NLS-1$
89
- try (ArchiveInputStream in = new ZipArchiveInputStream (new FileInputStream (pArchiveFullFileName ))) {
90
+ try (ZipArchiveInputStream in = new ZipArchiveInputStream (new FileInputStream (pArchiveFullFileName ))) {
90
91
return extract (in , pInstallPath .toFile (), 1 , pForceDownload , pMonitor );
91
92
} catch (IOException | InterruptedException e ) {
92
93
return new Status (IStatus .ERROR , Activator .getId (), faileToExtractMessage , e );
93
94
}
94
95
} else if (pArchiveFileName .endsWith ("tar.gz" )) { //$NON-NLS-1$
95
- try (ArchiveInputStream in = new TarArchiveInputStream (
96
+ try (TarArchiveInputStream in = new TarArchiveInputStream (
96
97
new GzipCompressorInputStream (new FileInputStream (pArchiveFullFileName )))) {
97
98
return extract (in , pInstallPath .toFile (), 1 , pForceDownload , pMonitor );
98
99
} catch (IOException | InterruptedException e ) {
99
100
return new Status (IStatus .ERROR , Activator .getId (), faileToExtractMessage , e );
100
101
}
102
+ } else if (pArchiveFileName .endsWith ("tar.zst" )) { //$NON-NLS-1$
103
+ try (TarArchiveInputStream in = new TarArchiveInputStream (
104
+ new ZstdCompressorInputStream (new FileInputStream (pArchiveFullFileName )))) {
105
+ return extract (in , pInstallPath .toFile (), 1 , pForceDownload , pMonitor );
106
+ } catch (IOException | InterruptedException e ) {
107
+ return new Status (IStatus .ERROR , Activator .getId (), faileToExtractMessage , e );
108
+ }
101
109
} else if (pArchiveFileName .endsWith ("tar" )) { //$NON-NLS-1$
102
- try (ArchiveInputStream in = new TarArchiveInputStream (new FileInputStream (pArchiveFullFileName ))) {
110
+ try (TarArchiveInputStream in = new TarArchiveInputStream (new FileInputStream (pArchiveFullFileName ))) {
103
111
return extract (in , pInstallPath .toFile (), 1 , pForceDownload , pMonitor );
104
112
} catch (IOException | InterruptedException e ) {
105
113
return new Status (IStatus .ERROR , Activator .getId (), faileToExtractMessage , e );
@@ -109,7 +117,7 @@ private static IStatus processArchive(String pArchiveFileName, IPath pInstallPat
109
117
}
110
118
}
111
119
112
- private static IStatus extract (ArchiveInputStream in , File destFolder , int stripPath , boolean overwrite ,
120
+ private static IStatus extract (ArchiveInputStream <?> in , File destFolder , int stripPath , boolean overwrite ,
113
121
IProgressMonitor pMonitor ) throws IOException , InterruptedException {
114
122
115
123
// Folders timestamps must be set at the end of archive extraction
0 commit comments