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
/**
@@ -214,12 +238,15 @@ public static String getFileName(String compressedName) {
214
238
|| isGzip (compressedName )
215
239
|| isBzip2 (compressedName )
216
240
|| isLzma (compressedName )
217
- || isXz (compressedName )) {
241
+ || isXz (compressedName )
242
+ || isZst (compressedName )
243
+ || isIso (compressedName )) {
218
244
return compressedName .substring (0 , compressedName .lastIndexOf ("." ));
219
245
} else if (isGzippedTar (compressedName )
220
246
|| isXzippedTar (compressedName )
221
247
|| isLzippedTar (compressedName )
222
- || isBzippedTar (compressedName )) {
248
+ || isBzippedTar (compressedName )
249
+ || isZstdTar (compressedName )) {
223
250
return compressedName .substring (0 , Utils .nthToLastCharIndex (2 , compressedName , '.' ));
224
251
} else {
225
252
return compressedName ;
@@ -265,6 +292,10 @@ private static boolean isLzippedTar(String type) {
265
292
return type .endsWith (fileExtensionTarLzma );
266
293
}
267
294
295
+ private static boolean isZstdTar (String type ) {
296
+ return type .endsWith (fileExtensionTarZst );
297
+ }
298
+
268
299
private static boolean isXz (String type ) {
269
300
return type .endsWith (fileExtensionXz ) && !isXzippedTar (type );
270
301
}
@@ -281,6 +312,14 @@ private static boolean isBzip2(String type) {
281
312
return type .endsWith (fileExtensionBzip2 ) && !isBzippedTar (type );
282
313
}
283
314
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
+
284
323
private static String getExtension (String path ) {
285
324
return path .substring (path .indexOf ('.' ) + 1 ).toLowerCase ();
286
325
}
0 commit comments