package o; import java.io.OutputStream; /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.giv, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C15167giv implements InterfaceC15168giw { private final C15139giB c; private final OutputStream e; public C15167giv(OutputStream outputStream, C15139giB c15139giB) { C14957gcv.e(outputStream, ""); C14957gcv.e(c15139giB, ""); this.e = outputStream; this.c = c15139giB; } @Override // o.InterfaceC15168giw, java.io.Flushable public final void flush() { this.e.flush(); } @Override // o.InterfaceC15168giw, java.io.Closeable, java.lang.AutoCloseable public final void close() { this.e.close(); } public final String toString() { StringBuilder sb = new StringBuilder("sink("); sb.append(this.e); sb.append(')'); return sb.toString(); } @Override // o.InterfaceC15168giw public final void write(C15111ghZ c15111ghZ, long j) { C14957gcv.e(c15111ghZ, ""); giE.d(c15111ghZ.c, 0L, j); while (j > 0) { this.c.throwIfReached(); C15170giy c15170giy = c15111ghZ.d; C14957gcv.e(c15170giy); int min = (int) Math.min(j, c15170giy.d - c15170giy.e); this.e.write(c15170giy.c, c15170giy.e, min); c15170giy.e += min; long j2 = min; j -= j2; c15111ghZ.c -= j2; if (c15170giy.e == c15170giy.d) { c15111ghZ.d = c15170giy.d(); C15169gix.e(c15170giy); } } } @Override // o.InterfaceC15168giw public final C15139giB timeout() { return this.c; } }