package o; import java.io.IOException; import java.io.InputStream; /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gik, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C15156gik implements giD { private final InputStream a; private final C15139giB b; public C15156gik(InputStream inputStream, C15139giB c15139giB) { C14957gcv.e(inputStream, ""); C14957gcv.e(c15139giB, ""); this.a = inputStream; this.b = c15139giB; } @Override // o.giD public final long read(C15111ghZ c15111ghZ, long j) { C14957gcv.e(c15111ghZ, ""); if (j == 0) { return 0L; } if (j < 0) { throw new IllegalArgumentException("byteCount < 0: ".concat(String.valueOf(j)).toString()); } try { this.b.throwIfReached(); C15170giy d = c15111ghZ.d(1); int read = this.a.read(d.c, d.d, (int) Math.min(j, 8192 - d.d)); if (read == -1) { if (d.e != d.d) { return -1L; } c15111ghZ.d = d.d(); C15169gix.e(d); return -1L; } d.d += read; long j2 = read; c15111ghZ.c += j2; return j2; } catch (AssertionError e) { if (C15160gio.a(e)) { throw new IOException(e); } throw e; } } @Override // o.giD, java.io.Closeable, java.lang.AutoCloseable public final void close() { this.a.close(); } public final String toString() { StringBuilder sb = new StringBuilder("source("); sb.append(this.a); sb.append(')'); return sb.toString(); } @Override // o.giD public final C15139giB timeout() { return this.b; } }