30
30
import com .amaze .filemanager .filesystem .compressed .extractcontents .Extractor ;
31
31
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .Bzip2Extractor ;
32
32
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .GzipExtractor ;
33
+ import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .Iso9660Extractor ;
33
34
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .LzmaExtractor ;
34
35
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .RarExtractor ;
35
36
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .SevenZipExtractor ;
38
39
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarGzExtractor ;
39
40
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarLzmaExtractor ;
40
41
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarXzExtractor ;
42
+ import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .TarZstExtractor ;
41
43
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .XzExtractor ;
42
44
import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .ZipExtractor ;
45
+ import com .amaze .filemanager .filesystem .compressed .extractcontents .helpers .ZstdExtractor ;
43
46
import com .amaze .filemanager .filesystem .compressed .showcontents .Decompressor ;
47
+ import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .Iso9660Decompressor ;
44
48
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .RarDecompressor ;
45
49
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .SevenZipDecompressor ;
46
50
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarBzip2Decompressor ;
47
51
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarDecompressor ;
48
52
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarGzDecompressor ;
49
53
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarLzmaDecompressor ;
50
54
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarXzDecompressor ;
55
+ import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .TarZstDecompressor ;
51
56
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .UnknownCompressedFileDecompressor ;
52
57
import com .amaze .filemanager .filesystem .compressed .showcontents .helpers .ZipDecompressor ;
53
58
import com .amaze .filemanager .utils .Utils ;
@@ -80,10 +85,14 @@ public abstract class CompressedHelper {
80
85
public static final String fileExtension7zip = "7z" ;
81
86
public static final String fileExtensionTarLzma = "tar.lzma" ;
82
87
public static final String fileExtensionTarXz = "tar.xz" ;
88
+ public static final String fileExtensionTarZst = "tar.zst" ;
83
89
public static final String fileExtensionXz = "xz" ;
84
90
public static final String fileExtensionLzma = "lzma" ;
85
91
public static final String fileExtensionGz = "gz" ;
86
92
public static final String fileExtensionBzip2 = "bz2" ;
93
+ public static final String fileExtensionZst = "zst" ;
94
+
95
+ public static final String fileExtensionIso = "iso" ;
87
96
88
97
private static final String TAG = CompressedHelper .class .getSimpleName ();
89
98
@@ -114,6 +123,9 @@ public static Extractor getExtractorInstance(
114
123
} else if (isLzippedTar (type )) {
115
124
extractor =
116
125
new TarLzmaExtractor (context , file .getPath (), outputPath , listener , updatePosition );
126
+ } else if (isZstdTar (type )) {
127
+ extractor =
128
+ new TarZstExtractor (context , file .getPath (), outputPath , listener , updatePosition );
117
129
} else if (is7zip (type )) {
118
130
extractor =
119
131
new SevenZipExtractor (context , file .getPath (), outputPath , listener , updatePosition );
@@ -125,6 +137,11 @@ public static Extractor getExtractorInstance(
125
137
extractor = new GzipExtractor (context , file .getPath (), outputPath , listener , updatePosition );
126
138
} else if (isBzip2 (type )) {
127
139
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 );
128
145
} else {
129
146
if (BuildConfig .DEBUG ) {
130
147
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
156
173
decompressor = new TarXzDecompressor (context );
157
174
} else if (isLzippedTar (type )) {
158
175
decompressor = new TarLzmaDecompressor (context );
176
+ } else if (isZstdTar (type )) {
177
+ decompressor = new TarZstDecompressor (context );
159
178
} else if (is7zip (type )) {
160
179
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 )) {
162
183
// These 4 types are only compressing one single file.
163
184
// Hence invoking this UnknownCompressedFileDecompressor which only returns the filename
164
185
// without the compression extension
@@ -190,10 +211,13 @@ public static boolean isFileExtractable(String path) {
190
211
|| isBzippedTar (type )
191
212
|| isXzippedTar (type )
192
213
|| isLzippedTar (type )
214
+ || isZstdTar (type )
193
215
|| isBzip2 (type )
194
216
|| isGzip (type )
195
217
|| isLzma (type )
196
- || isXz (type );
218
+ || isXz (type )
219
+ || isZst (type )
220
+ || isIso (type );
197
221
}
198
222
199
223
/**
@@ -216,12 +240,15 @@ public static String getFileName(String compressedName) {
216
240
|| isGzip (compressedName )
217
241
|| isBzip2 (compressedName )
218
242
|| isLzma (compressedName )
219
- || isXz (compressedName ))) {
243
+ || isXz (compressedName )
244
+ || isZst (compressedName )
245
+ || isIso (compressedName ))) {
220
246
return compressedName .substring (0 , compressedName .lastIndexOf ("." ));
221
247
} else if (hasFileName && isGzippedTar (compressedName )
222
248
|| isXzippedTar (compressedName )
223
249
|| isLzippedTar (compressedName )
224
- || isBzippedTar (compressedName )) {
250
+ || isBzippedTar (compressedName )
251
+ || isZstdTar (compressedName )) {
225
252
return compressedName .substring (0 , Utils .nthToLastCharIndex (2 , compressedName , '.' ));
226
253
} else {
227
254
return compressedName ;
@@ -267,6 +294,10 @@ private static boolean isLzippedTar(String type) {
267
294
return type .endsWith (fileExtensionTarLzma );
268
295
}
269
296
297
+ private static boolean isZstdTar (String type ) {
298
+ return type .endsWith (fileExtensionTarZst );
299
+ }
300
+
270
301
private static boolean isXz (String type ) {
271
302
return type .endsWith (fileExtensionXz ) && !isXzippedTar (type );
272
303
}
@@ -283,6 +314,14 @@ private static boolean isBzip2(String type) {
283
314
return type .endsWith (fileExtensionBzip2 ) && !isBzippedTar (type );
284
315
}
285
316
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
+
286
325
private static String getExtension (String path ) {
287
326
return path .substring (path .indexOf ('.' ) + 1 ).toLowerCase ();
288
327
}
0 commit comments