2021-08-03 07:33:18 +00:00
|
|
|
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);
|
2021-08-31 06:34:54 +00:00
|
|
|
int read = this.i.read(N.a, N.f2855c, (int) Math.min(j, (long) (8192 - N.f2855c)));
|
2021-08-03 07:33:18 +00:00
|
|
|
if (read != -1) {
|
2021-08-31 06:34:54 +00:00
|
|
|
N.f2855c += read;
|
2021-08-03 07:33:18 +00:00
|
|
|
long j2 = (long) read;
|
|
|
|
eVar.j += j2;
|
|
|
|
return j2;
|
2021-08-31 06:34:54 +00:00
|
|
|
} else if (N.b != N.f2855c) {
|
2021-08-03 07:33:18 +00:00
|
|
|
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 {
|
2021-08-28 06:29:07 +00:00
|
|
|
throw new IllegalArgumentException(c.d.b.a.a.q("byteCount < 0: ", j).toString());
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.x
|
|
|
|
public y timeout() {
|
|
|
|
return this.j;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Object
|
|
|
|
public String toString() {
|
2021-08-28 06:29:07 +00:00
|
|
|
StringBuilder P = c.d.b.a.a.P("source(");
|
|
|
|
P.append(this.i);
|
|
|
|
P.append(')');
|
|
|
|
return P.toString();
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|