2021-11-08 18:25:28 +00:00
|
|
|
package g0;
|
|
|
|
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import c.i.a.f.e.o.f;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
/* compiled from: JvmOkio.kt */
|
|
|
|
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");
|
|
|
|
int i = (j > 0 ? 1 : (j == 0 ? 0 : -1));
|
|
|
|
if (i == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
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);
|
2021-12-17 22:03:14 +00:00
|
|
|
int read = this.j.read(N.a, N.f2949c, (int) Math.min(j, (long) (8192 - N.f2949c)));
|
2021-11-08 18:25:28 +00:00
|
|
|
if (read != -1) {
|
2021-12-17 22:03:14 +00:00
|
|
|
N.f2949c += read;
|
2021-11-08 18:25:28 +00:00
|
|
|
long j2 = (long) read;
|
2021-12-17 22:03:14 +00:00
|
|
|
eVar.k += j2;
|
2021-11-08 18:25:28 +00:00
|
|
|
return j2;
|
2021-12-17 22:03:14 +00:00
|
|
|
} else if (N.b != N.f2949c) {
|
2021-11-08 18:25:28 +00:00
|
|
|
return -1;
|
|
|
|
} else {
|
2021-12-17 22:03:14 +00:00
|
|
|
eVar.j = N.a();
|
2021-11-08 18:25:28 +00:00
|
|
|
t.a(N);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} catch (AssertionError e) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (f.x0(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
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Object
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder R = a.R("source(");
|
2021-12-17 22:03:14 +00:00
|
|
|
R.append(this.j);
|
2021-11-08 18:25:28 +00:00
|
|
|
R.append(')');
|
|
|
|
return R.toString();
|
|
|
|
}
|
|
|
|
}
|