discord-jadx/app/src/main/java/g0/p.java
2021-12-04 08:30:04 +01:00

65 lines
1.6 KiB
Java

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 j;
public final y k;
public p(OutputStream outputStream, y yVar) {
m.checkParameterIsNotNull(outputStream, "out");
m.checkParameterIsNotNull(yVar, "timeout");
this.j = outputStream;
this.k = yVar;
}
@Override // g0.v, java.io.Closeable, java.lang.AutoCloseable
public void close() {
this.j.close();
}
@Override // g0.v, java.io.Flushable
public void flush() {
this.j.flush();
}
@Override // g0.v
public y timeout() {
return this.k;
}
@Override // java.lang.Object
public String toString() {
StringBuilder R = a.R("sink(");
R.append(this.j);
R.append(')');
return R.toString();
}
@Override // g0.v
public void write(e eVar, long j) {
m.checkParameterIsNotNull(eVar, "source");
f.A(eVar.k, 0, j);
while (j > 0) {
this.k.f();
s sVar = eVar.j;
if (sVar == null) {
m.throwNpe();
}
int min = (int) Math.min(j, (long) (sVar.f2947c - sVar.b));
this.j.write(sVar.a, sVar.b, min);
int i = sVar.b + min;
sVar.b = i;
long j2 = (long) min;
j -= j2;
eVar.k -= j2;
if (i == sVar.f2947c) {
eVar.j = sVar.a();
t.a(sVar);
}
}
}
}