package com.kofax.mobile.sdk.extract.id.bundle; import com.kofax.kmc.kut.utilities.error.IllegalArgumentException; 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.ZipInputStream; import o.C15195gjp; import o.gjJ; /* loaded from: classes3.dex */ public class ZipInputStreamBundle implements IBundle, Enumeration { private final ZipInputStream afM; private IBundleFile afN = null; @Override // com.kofax.mobile.sdk.extract.id.bundle.IBundle public Enumeration list() { return this; } public ZipInputStreamBundle(ZipInputStream zipInputStream) { if (zipInputStream == null) { throw new IllegalArgumentException("file cannot be null"); } this.afM = zipInputStream; } public ZipInputStreamBundle(InputStream inputStream) { if (inputStream == null) { throw new IllegalArgumentException("file cannot be null"); } this.afM = new ZipInputStream(inputStream); } @Override // java.util.Enumeration public boolean hasMoreElements() { IBundleFile nextElement = nextElement(); this.afN = nextElement; return nextElement != null; } /* JADX WARN: Can't rename method to resolve collision */ @Override // java.util.Enumeration public IBundleFile nextElement() { IBundleFile iBundleFile = this.afN; if (iBundleFile != null) { this.afN = null; return iBundleFile; } try { ZipEntry nextEntry = this.afM.getNextEntry(); if (nextEntry != null) { return new a(this, nextEntry); } return null; } catch (Exception unused) { return null; } } @Override // java.io.Closeable, java.lang.AutoCloseable public void close() throws IOException { this.afM.close(); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes3.dex */ public class a implements IBundleFile { private final ZipEntry afJ; final ZipInputStreamBundle afO; a(ZipInputStreamBundle zipInputStreamBundle, ZipEntry zipEntry) { this.afO = zipInputStreamBundle; 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 (IOException 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) { FileOutputStream fileOutputStream; FileOutputStream fileOutputStream2 = null; try { try { fileOutputStream = new FileOutputStream(file); } catch (Exception e) { e = e; } } catch (Throwable th) { th = th; fileOutputStream = fileOutputStream2; } try { C15195gjp.c(this.afO.afM, fileOutputStream); C15195gjp.e(fileOutputStream); } catch (Exception e2) { e = e2; fileOutputStream2 = fileOutputStream; throw new RuntimeException("could not get file", e); } catch (Throwable th2) { th = th2; C15195gjp.e(fileOutputStream); 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(), "/"); if (!this.afJ.getName().contains("/")) { return this.afJ.getName(); } return gjJ.g(d, "/"); } } }