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

73 lines
1.9 KiB
Java
Raw Normal View History

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.IOException;
import java.io.InputStream;
/* compiled from: JvmOkio.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes3.dex */
2021-11-08 18:25:28 +00:00
public final class n implements x {
2021-12-17 22:03:14 +00:00
public final InputStream j;
public final y k;
2021-11-08 18:25:28 +00:00
public n(InputStream inputStream, y yVar) {
m.checkParameterIsNotNull(inputStream, "input");
m.checkParameterIsNotNull(yVar, "timeout");
2021-12-17 22:03:14 +00:00
this.j = inputStream;
this.k = yVar;
2021-11-08 18:25:28 +00:00
}
@Override // g0.x, 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.x
public long i0(e eVar, long j) {
m.checkParameterIsNotNull(eVar, "sink");
2022-03-02 20:59:20 +00:00
int i = (j > 0L ? 1 : (j == 0L ? 0 : -1));
2021-11-08 18:25:28 +00:00
if (i == 0) {
2022-03-02 20:59:20 +00:00
return 0L;
2021-11-08 18:25:28 +00:00
}
if (i >= 0) {
try {
2021-12-17 22:03:14 +00:00
this.k.f();
2021-11-08 18:25:28 +00:00
s N = eVar.N(1);
2022-03-02 20:59:20 +00:00
int read = this.j.read(N.a, N.c, (int) Math.min(j, 8192 - N.c));
2021-11-08 18:25:28 +00:00
if (read != -1) {
2021-12-21 23:37:30 +00:00
N.c += read;
2022-03-02 20:59:20 +00:00
long j2 = read;
2021-12-17 22:03:14 +00:00
eVar.k += j2;
2021-11-08 18:25:28 +00:00
return j2;
2022-03-30 16:43:10 +00:00
} else if (N.f3675b != N.c) {
2022-03-02 20:59:20 +00:00
return -1L;
2021-11-08 18:25:28 +00:00
} else {
2021-12-17 22:03:14 +00:00
eVar.j = N.a();
2021-11-08 18:25:28 +00:00
t.a(N);
2022-03-02 20:59:20 +00:00
return -1L;
2021-11-08 18:25:28 +00:00
}
} catch (AssertionError e) {
2022-01-27 00:50:41 +00:00
if (f.z0(e)) {
2021-11-08 18:25:28 +00:00
throw new IOException(e);
}
throw e;
}
} else {
throw new IllegalArgumentException(a.s("byteCount < 0: ", j).toString());
}
}
@Override // g0.x
public y timeout() {
2021-12-17 22:03:14 +00:00
return this.k;
2021-11-08 18:25:28 +00:00
}
public String toString() {
2022-03-30 16:43:10 +00:00
StringBuilder R = a.R("source(");
R.append(this.j);
R.append(')');
return R.toString();
2021-11-08 18:25:28 +00:00
}
}