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