3030import com .amaze .filemanager .filesystem .compressed .extractcontents .Extractor ;
3131import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .Bzip2Extractor ;
3232import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .GzipExtractor ;
33+ import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .Iso9660Extractor ;
3334import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .LzmaExtractor ;
3435import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .RarExtractor ;
3536import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .SevenZipExtractor ;
3839import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarGzExtractor ;
3940import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarLzmaExtractor ;
4041import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarXzExtractor ;
42+ import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarZstExtractor ;
4143import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .XzExtractor ;
4244import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .ZipExtractor ;
45+ import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .ZstdExtractor ;
4346import com .amaze .filemanager .filesystem .compressed .showcontents .Decompressor ;
47+ import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .Iso9660Decompressor ;
4448import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .RarDecompressor ;
4549import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .SevenZipDecompressor ;
4650import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarBzip2Decompressor ;
4751import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarDecompressor ;
4852import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarGzDecompressor ;
4953import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarLzmaDecompressor ;
5054import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarXzDecompressor ;
55+ import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarZstDecompressor ;
5156import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .UnknownCompressedFileDecompressor ;
5257import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .ZipDecompressor ;
5358import com .amaze .filemanager .utils .Utils ;
@@ -80,10 +85,14 @@ public abstract class CompressedHelper {
8085 public static final String fileExtension7zip = "7z" ;
8186 public static final String fileExtensionTarLzma = "tar.lzma" ;
8287 public static final String fileExtensionTarXz = "tar.xz" ;
88+ public static final String fileExtensionTarZst = "tar.zst" ;
8389 public static final String fileExtensionXz = "xz" ;
8490 public static final String fileExtensionLzma = "lzma" ;
8591 public static final String fileExtensionGz = "gz" ;
8692 public static final String fileExtensionBzip2 = "bz2" ;
93+ public static final String fileExtensionZst = "zst" ;
94+
95+ public static final String fileExtensionIso = "iso" ;
8796
8897 private static final String TAG = CompressedHelper .class .getSimpleName ();
8998
@@ -114,6 +123,9 @@ public static Extractor getExtractorInstance(
114123 } else if (isLzippedTar (type )) {
115124 extractor =
116125 new TarLzmaExtractor (context , file .getPath (), outputPath , listener , updatePosition );
126+ } else if (isZstdTar (type )) {
127+ extractor =
128+ new TarZstExtractor (context , file .getPath (), outputPath , listener , updatePosition );
117129 } else if (is7zip (type )) {
118130 extractor =
119131 new SevenZipExtractor (context , file .getPath (), outputPath , listener , updatePosition );
@@ -125,6 +137,11 @@ public static Extractor getExtractorInstance(
125137 extractor = new GzipExtractor (context , file .getPath (), outputPath , listener , updatePosition );
126138 } else if (isBzip2 (type )) {
127139 extractor = new Bzip2Extractor (context , file .getPath (), outputPath , listener , updatePosition );
140+ } else if (isZst (type )) {
141+ extractor = new ZstdExtractor (context , file .getPath (), outputPath , listener , updatePosition );
142+ } else if (isIso (type )) {
143+ extractor =
144+ new Iso9660Extractor (context , file .getPath (), outputPath , listener , updatePosition );
128145 } else {
129146 if (BuildConfig .DEBUG ) {
130147 throw new IllegalArgumentException ("The compressed file has no way of opening it: " + file );
@@ -156,9 +173,13 @@ public static Decompressor getCompressorInstance(@NonNull Context context, @NonN
156173 decompressor = new TarXzDecompressor (context );
157174 } else if (isLzippedTar (type )) {
158175 decompressor = new TarLzmaDecompressor (context );
176+ } else if (isZstdTar (type )) {
177+ decompressor = new TarZstDecompressor (context );
159178 } else if (is7zip (type )) {
160179 decompressor = new SevenZipDecompressor (context );
161- } else if (isXz (type ) || isLzma (type ) || isGzip (type ) || isBzip2 (type )) {
180+ } else if (isIso (type )) {
181+ decompressor = new Iso9660Decompressor (context );
182+ } else if (isXz (type ) || isLzma (type ) || isGzip (type ) || isBzip2 (type ) || isZst (type )) {
162183 // These 4 types are only compressing one single file.
163184 // Hence invoking this UnknownCompressedFileDecompressor which only returns the filename
164185 // without the compression extension
@@ -190,10 +211,13 @@ public static boolean isFileExtractable(String path) {
190211 || isBzippedTar (type )
191212 || isXzippedTar (type )
192213 || isLzippedTar (type )
214+ || isZstdTar (type )
193215 || isBzip2 (type )
194216 || isGzip (type )
195217 || isLzma (type )
196- || isXz (type );
218+ || isXz (type )
219+ || isZst (type )
220+ || isIso (type );
197221 }
198222
199223 /**
@@ -214,12 +238,15 @@ public static String getFileName(String compressedName) {
214238 || isGzip (compressedName )
215239 || isBzip2 (compressedName )
216240 || isLzma (compressedName )
217- || isXz (compressedName )) {
241+ || isXz (compressedName )
242+ || isZst (compressedName )
243+ || isIso (compressedName )) {
218244 return compressedName .substring (0 , compressedName .lastIndexOf ("." ));
219245 } else if (isGzippedTar (compressedName )
220246 || isXzippedTar (compressedName )
221247 || isLzippedTar (compressedName )
222- || isBzippedTar (compressedName )) {
248+ || isBzippedTar (compressedName )
249+ || isZstdTar (compressedName )) {
223250 return compressedName .substring (0 , Utils .nthToLastCharIndex (2 , compressedName , '.' ));
224251 } else {
225252 return compressedName ;
@@ -265,6 +292,10 @@ private static boolean isLzippedTar(String type) {
265292 return type .endsWith (fileExtensionTarLzma );
266293 }
267294
295+ private static boolean isZstdTar (String type ) {
296+ return type .endsWith (fileExtensionTarZst );
297+ }
298+
268299 private static boolean isXz (String type ) {
269300 return type .endsWith (fileExtensionXz ) && !isXzippedTar (type );
270301 }
@@ -281,6 +312,14 @@ private static boolean isBzip2(String type) {
281312 return type .endsWith (fileExtensionBzip2 ) && !isBzippedTar (type );
282313 }
283314
315+ private static boolean isZst (String type ) {
316+ return type .endsWith (fileExtensionZst ) && !isZstdTar (type );
317+ }
318+
319+ private static boolean isIso (String type ) {
320+ return type .endsWith (fileExtensionIso );
321+ }
322+
284323 private static String getExtension (String path ) {
285324 return path .substring (path .indexOf ('.' ) + 1 ).toLowerCase ();
286325 }
0 commit comments