2021-11-08 18:25:28 +00:00
|
|
|
package g0;
|
|
|
|
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import c.i.a.f.e.o.f;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
/* compiled from: JvmOkio.kt */
|
|
|
|
public final class p implements v {
|
|
|
|
public final OutputStream i;
|
|
|
|
public final y j;
|
|
|
|
|
|
|
|
public p(OutputStream outputStream, y yVar) {
|
|
|
|
m.checkParameterIsNotNull(outputStream, "out");
|
|
|
|
m.checkParameterIsNotNull(yVar, "timeout");
|
|
|
|
this.i = outputStream;
|
|
|
|
this.j = yVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v, java.io.Closeable, java.lang.AutoCloseable
|
|
|
|
public void close() {
|
|
|
|
this.i.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v, java.io.Flushable
|
|
|
|
public void flush() {
|
|
|
|
this.i.flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v
|
|
|
|
public y timeout() {
|
|
|
|
return this.j;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Object
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder R = a.R("sink(");
|
|
|
|
R.append(this.i);
|
|
|
|
R.append(')');
|
|
|
|
return R.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v
|
|
|
|
public void write(e eVar, long j) {
|
|
|
|
m.checkParameterIsNotNull(eVar, "source");
|
|
|
|
f.w(eVar.j, 0, j);
|
|
|
|
while (j > 0) {
|
|
|
|
this.j.f();
|
|
|
|
s sVar = eVar.i;
|
|
|
|
if (sVar == null) {
|
|
|
|
m.throwNpe();
|
|
|
|
}
|
2021-11-30 23:47:08 +00:00
|
|
|
int min = (int) Math.min(j, (long) (sVar.f2885c - sVar.b));
|
2021-11-08 18:25:28 +00:00
|
|
|
this.i.write(sVar.a, sVar.b, min);
|
|
|
|
int i = sVar.b + min;
|
|
|
|
sVar.b = i;
|
|
|
|
long j2 = (long) min;
|
|
|
|
j -= j2;
|
|
|
|
eVar.j -= j2;
|
2021-11-30 23:47:08 +00:00
|
|
|
if (i == sVar.f2885c) {
|
2021-11-08 18:25:28 +00:00
|
|
|
eVar.i = sVar.a();
|
|
|
|
t.a(sVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|