package com.google.android.play.core.assetpacks; import java.io.InputStream; /* loaded from: classes2.dex */ final class g0 extends InputStream { /* renamed from: a, reason: collision with root package name */ private final InputStream f4882a; /* renamed from: b, reason: collision with root package name */ private long f4883b; g0(InputStream inputStream, long j10) { this.f4882a = inputStream; this.f4883b = j10; } @Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable public final void close() { super.close(); this.f4882a.close(); this.f4883b = 0L; } @Override // java.io.InputStream public final int read() { long j10 = this.f4883b; if (j10 <= 0) { return -1; } this.f4883b = j10 - 1; return this.f4882a.read(); } @Override // java.io.InputStream public final int read(byte[] bArr, int i10, int i11) { long j10 = this.f4883b; if (j10 <= 0) { return -1; } int read = this.f4882a.read(bArr, i10, (int) Math.min(i11, j10)); if (read != -1) { this.f4883b -= read; } return read; } }