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 /**
@@ -216,12 +240,15 @@ public static String getFileName(String compressedName) {
216240 || isGzip (compressedName )
217241 || isBzip2 (compressedName )
218242 || isLzma (compressedName )
219- || isXz (compressedName ))) {
243+ || isXz (compressedName )
244+ || isZst (compressedName )
245+ || isIso (compressedName ))) {
220246 return compressedName .substring (0 , compressedName .lastIndexOf ("." ));
221247 } else if (hasFileName && isGzippedTar (compressedName )
222248 || isXzippedTar (compressedName )
223249 || isLzippedTar (compressedName )
224- || isBzippedTar (compressedName )) {
250+ || isBzippedTar (compressedName )
251+ || isZstdTar (compressedName )) {
225252 return compressedName .substring (0 , Utils .nthToLastCharIndex (2 , compressedName , '.' ));
226253 } else {
227254 return compressedName ;
@@ -267,6 +294,10 @@ private static boolean isLzippedTar(String type) {
267294 return type .endsWith (fileExtensionTarLzma );
268295 }
269296
297+ private static boolean isZstdTar (String type ) {
298+ return type .endsWith (fileExtensionTarZst );
299+ }
300+
270301 private static boolean isXz (String type ) {
271302 return type .endsWith (fileExtensionXz ) && !isXzippedTar (type );
272303 }
@@ -283,6 +314,14 @@ private static boolean isBzip2(String type) {
283314 return type .endsWith (fileExtensionBzip2 ) && !isBzippedTar (type );
284315 }
285316
317+ private static boolean isZst (String type ) {
318+ return type .endsWith (fileExtensionZst ) && !isZstdTar (type );
319+ }
320+
321+ private static boolean isIso (String type ) {
322+ return type .endsWith (fileExtensionIso );
323+ }
324+
286325 private static String getExtension (String path ) {
287326 return path .substring (path .indexOf ('.' ) + 1 ).toLowerCase ();
288327 }
0 commit comments