package com.google.android.play.core.assetpacks; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; /* loaded from: classes2.dex */ final class u2 { /* renamed from: c, reason: collision with root package name */ private static final r3.h0 f5079c = new r3.h0("PatchSliceTaskHandler"); /* renamed from: a, reason: collision with root package name */ private final e0 f5080a; /* renamed from: b, reason: collision with root package name */ private final r3.o f5081b; u2(e0 e0Var, r3.o oVar) { this.f5080a = e0Var; this.f5081b = oVar; } public final void a(t2 t2Var) { e0 e0Var = this.f5080a; String str = t2Var.f5165b; int i10 = t2Var.f5059c; long j10 = t2Var.f5060d; File t10 = e0Var.t(str, i10, j10); File file = new File(e0Var.u(str, i10, j10), t2Var.f5064h); try { InputStream inputStream = t2Var.f5066j; if (t2Var.f5063g == 2) { inputStream = new GZIPInputStream(inputStream, 8192); } try { h0 h0Var = new h0(t10, file); File B = this.f5080a.B(t2Var.f5165b, t2Var.f5061e, t2Var.f5062f, t2Var.f5064h); if (!B.exists()) { B.mkdirs(); } b3 b3Var = new b3(this.f5080a, t2Var.f5165b, t2Var.f5061e, t2Var.f5062f, t2Var.f5064h); r3.k.a(h0Var, inputStream, new g1(B, b3Var), t2Var.f5065i); b3Var.i(0); inputStream.close(); f5079c.d("Patching and extraction finished for slice %s of pack %s.", t2Var.f5064h, t2Var.f5165b); ((t3) this.f5081b.a()).e(t2Var.f5164a, t2Var.f5165b, t2Var.f5064h, 0); try { t2Var.f5066j.close(); } catch (IOException unused) { f5079c.e("Could not close file for slice %s of pack %s.", t2Var.f5064h, t2Var.f5165b); } } finally { } } catch (IOException e10) { f5079c.b("IOException during patching %s.", e10.getMessage()); throw new d1(String.format("Error patching slice %s of pack %s.", t2Var.f5064h, t2Var.f5165b), e10, t2Var.f5164a); } } }