discord-jadx/app/src/main/java/g0/n.java
2021-07-04 17:26:29 +02:00

71 lines
1.9 KiB
Java

package g0;
import c.q.a.k.a;
import d0.z.d.m;
import java.io.IOException;
import java.io.InputStream;
/* compiled from: JvmOkio.kt */
public final class n implements x {
public final InputStream i;
public final y j;
public n(InputStream inputStream, y yVar) {
m.checkParameterIsNotNull(inputStream, "input");
m.checkParameterIsNotNull(yVar, "timeout");
this.i = inputStream;
this.j = yVar;
}
@Override // g0.x, java.io.Closeable, java.lang.AutoCloseable
public void close() {
this.i.close();
}
@Override // g0.x
public long h0(e eVar, long j) {
m.checkParameterIsNotNull(eVar, "sink");
int i = (j > 0 ? 1 : (j == 0 ? 0 : -1));
if (i == 0) {
return 0;
}
if (i >= 0) {
try {
this.j.f();
s N = eVar.N(1);
int read = this.i.read(N.a, N.f2775c, (int) Math.min(j, (long) (8192 - N.f2775c)));
if (read != -1) {
N.f2775c += read;
long j2 = (long) read;
eVar.j += j2;
return j2;
} else if (N.b != N.f2775c) {
return -1;
} else {
eVar.i = N.a();
t.a(N);
return -1;
}
} catch (AssertionError e) {
if (a.B(e)) {
throw new IOException(e);
}
throw e;
}
} else {
throw new IllegalArgumentException(c.d.b.a.a.q("byteCount < 0: ", j).toString());
}
}
@Override // g0.x
public y timeout() {
return this.j;
}
@Override // java.lang.Object
public String toString() {
StringBuilder L = c.d.b.a.a.L("source(");
L.append(this.i);
L.append(')');
return L.toString();
}
}