discord-jadx/app/src/main/java/g0/c.java

115 lines
2.8 KiB
Java
Raw Normal View History

2021-08-03 07:33:18 +00:00
package g0;
import c.d.b.a.a;
import d0.z.d.m;
import java.io.IOException;
/* compiled from: AsyncTimeout.kt */
public final class c implements v {
public final /* synthetic */ b i;
public final /* synthetic */ v j;
public c(b bVar, v vVar) {
this.i = bVar;
this.j = vVar;
}
@Override // g0.v, java.io.Closeable, java.lang.AutoCloseable
public void close() {
b bVar = this.i;
bVar.i();
try {
this.j.close();
if (bVar.j()) {
throw bVar.k(null);
}
} catch (IOException e) {
if (!bVar.j()) {
throw e;
}
throw bVar.k(e);
} finally {
bVar.j();
}
}
@Override // g0.v, java.io.Flushable
public void flush() {
b bVar = this.i;
bVar.i();
try {
this.j.flush();
if (bVar.j()) {
throw bVar.k(null);
}
} catch (IOException e) {
if (!bVar.j()) {
throw e;
}
throw bVar.k(e);
} finally {
bVar.j();
}
}
@Override // g0.v
public y timeout() {
return this.i;
}
@Override // java.lang.Object
public String toString() {
2021-08-28 06:29:07 +00:00
StringBuilder P = a.P("AsyncTimeout.sink(");
P.append(this.j);
P.append(')');
return P.toString();
2021-08-03 07:33:18 +00:00
}
@Override // g0.v
public void write(e eVar, long j) {
m.checkParameterIsNotNull(eVar, "source");
c.q.a.k.a.l(eVar.j, 0, j);
while (true) {
long j2 = 0;
if (j > 0) {
s sVar = eVar.i;
if (sVar == null) {
m.throwNpe();
}
while (true) {
if (j2 >= ((long) 65536)) {
break;
}
2021-09-07 06:52:02 +00:00
j2 += (long) (sVar.f2863c - sVar.b);
2021-08-03 07:33:18 +00:00
if (j2 >= j) {
j2 = j;
break;
}
sVar = sVar.f;
if (sVar == null) {
m.throwNpe();
}
}
b bVar = this.i;
bVar.i();
try {
this.j.write(eVar, j2);
if (!bVar.j()) {
j -= j2;
} else {
throw bVar.k(null);
}
} catch (IOException e) {
if (!bVar.j()) {
throw e;
}
throw bVar.k(e);
} finally {
bVar.j();
}
} else {
return;
}
}
}
}