158 lines
5.2 KiB
Java
158 lines
5.2 KiB
Java
|
package com.kofax.mobile.sdk.extract.id.bundle;
|
||
|
|
||
|
import java.io.File;
|
||
|
import java.io.FileOutputStream;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InputStream;
|
||
|
import java.util.Enumeration;
|
||
|
import java.util.zip.ZipEntry;
|
||
|
import java.util.zip.ZipFile;
|
||
|
import o.C15195gjp;
|
||
|
import o.gjJ;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class ZipFileBundle implements IBundle {
|
||
|
private final ZipFile afI;
|
||
|
|
||
|
public ZipFileBundle(ZipFile zipFile) {
|
||
|
if (zipFile == null) {
|
||
|
throw new IllegalArgumentException("file cannot be null");
|
||
|
}
|
||
|
this.afI = zipFile;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.extract.id.bundle.IBundle
|
||
|
public Enumeration<? extends IBundleFile> list() {
|
||
|
return new b(this, this.afI.entries());
|
||
|
}
|
||
|
|
||
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
||
|
public void close() throws IOException {
|
||
|
this.afI.close();
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
class b implements Enumeration<IBundleFile> {
|
||
|
final ZipFileBundle afK;
|
||
|
private final Enumeration<? extends ZipEntry> afL;
|
||
|
|
||
|
public b(ZipFileBundle zipFileBundle, Enumeration<? extends ZipEntry> enumeration) {
|
||
|
this.afK = zipFileBundle;
|
||
|
if (enumeration == null) {
|
||
|
throw new IllegalArgumentException("enumeration cannot be null");
|
||
|
}
|
||
|
this.afL = enumeration;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Enumeration
|
||
|
public boolean hasMoreElements() {
|
||
|
return this.afL.hasMoreElements();
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // java.util.Enumeration
|
||
|
public IBundleFile nextElement() {
|
||
|
return new a(this.afK, this.afL.nextElement());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class a implements IBundleFile {
|
||
|
private final ZipEntry afJ;
|
||
|
final ZipFileBundle afK;
|
||
|
|
||
|
a(ZipFileBundle zipFileBundle, ZipEntry zipEntry) {
|
||
|
this.afK = zipFileBundle;
|
||
|
this.afJ = zipEntry;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.extract.id.bundle.IBundleFile
|
||
|
public File getFile() {
|
||
|
try {
|
||
|
File createTempFile = File.createTempFile("__zipBundle__", "__");
|
||
|
j(createTempFile);
|
||
|
return createTempFile;
|
||
|
} catch (Exception e) {
|
||
|
throw new RuntimeException("could not get file", e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.extract.id.bundle.IBundleFile
|
||
|
public void getFile(File file) {
|
||
|
j(file);
|
||
|
}
|
||
|
|
||
|
private void j(File file) {
|
||
|
Throwable th;
|
||
|
InputStream inputStream;
|
||
|
FileOutputStream fileOutputStream;
|
||
|
Exception e;
|
||
|
Throwable th2;
|
||
|
FileOutputStream fileOutputStream2 = null;
|
||
|
try {
|
||
|
fileOutputStream = new FileOutputStream(file);
|
||
|
} catch (Exception e2) {
|
||
|
fileOutputStream = null;
|
||
|
e = e2;
|
||
|
inputStream = null;
|
||
|
} catch (Throwable th3) {
|
||
|
th = th3;
|
||
|
inputStream = null;
|
||
|
C15195gjp.e(fileOutputStream2);
|
||
|
C15195gjp.d(inputStream);
|
||
|
throw th;
|
||
|
}
|
||
|
try {
|
||
|
inputStream = this.afK.afI.getInputStream(this.afJ);
|
||
|
try {
|
||
|
try {
|
||
|
C15195gjp.c(inputStream, fileOutputStream);
|
||
|
C15195gjp.e(fileOutputStream);
|
||
|
C15195gjp.d(inputStream);
|
||
|
} catch (Exception e3) {
|
||
|
e = e3;
|
||
|
throw new RuntimeException("could not get file", e);
|
||
|
}
|
||
|
} catch (Throwable th4) {
|
||
|
th2 = th4;
|
||
|
FileOutputStream fileOutputStream3 = fileOutputStream;
|
||
|
th = th2;
|
||
|
fileOutputStream2 = fileOutputStream3;
|
||
|
C15195gjp.e(fileOutputStream2);
|
||
|
C15195gjp.d(inputStream);
|
||
|
throw th;
|
||
|
}
|
||
|
} catch (Exception e4) {
|
||
|
e = e4;
|
||
|
inputStream = null;
|
||
|
} catch (Throwable th5) {
|
||
|
th2 = th5;
|
||
|
inputStream = null;
|
||
|
FileOutputStream fileOutputStream32 = fileOutputStream;
|
||
|
th = th2;
|
||
|
fileOutputStream2 = fileOutputStream32;
|
||
|
C15195gjp.e(fileOutputStream2);
|
||
|
C15195gjp.d(inputStream);
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.extract.id.bundle.IBundleFile
|
||
|
public boolean isDirectory() {
|
||
|
return this.afJ.isDirectory();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.extract.id.bundle.IBundleFile
|
||
|
public String getAbsolutePath() {
|
||
|
return this.afJ.getName();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.extract.id.bundle.IBundleFile
|
||
|
public String getName() {
|
||
|
String d = gjJ.d(this.afJ.getName(), "/");
|
||
|
return d.contains("/") ? gjJ.g(d, "/") : d;
|
||
|
}
|
||
|
}
|
||
|
}
|