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

72 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.f2864c, (int) Math.min(j, (long) (8192 - N.f2864c)));
if (read != -1) {
N.f2864c += read;
long j2 = (long) read;
eVar.j += j2;
return j2;
} else if (N.b != N.f2864c) {
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 P = c.d.b.a.a.P("source(");
P.append(this.i);
P.append(')');
return P.toString();
}
}