2021-08-03 07:33:18 +00:00
|
|
|
package g0;
|
|
|
|
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import java.io.EOFException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.zip.DataFormatException;
|
|
|
|
import java.util.zip.Inflater;
|
|
|
|
/* compiled from: InflaterSource.kt */
|
|
|
|
public final class m implements x {
|
|
|
|
public int i;
|
|
|
|
public boolean j;
|
|
|
|
public final g k;
|
|
|
|
public final Inflater l;
|
|
|
|
|
|
|
|
public m(g gVar, Inflater inflater) {
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(gVar, "source");
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(inflater, "inflater");
|
|
|
|
this.k = gVar;
|
|
|
|
this.l = inflater;
|
|
|
|
}
|
|
|
|
|
|
|
|
public m(x xVar, Inflater inflater) {
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(xVar, "source");
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(inflater, "inflater");
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(xVar, "$this$buffer");
|
|
|
|
r rVar = new r(xVar);
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(rVar, "source");
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(inflater, "inflater");
|
|
|
|
this.k = rVar;
|
|
|
|
this.l = inflater;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final long a(e eVar, long j) throws IOException {
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(eVar, "sink");
|
|
|
|
int i = (j > 0 ? 1 : (j == 0 ? 0 : -1));
|
|
|
|
if (!(i >= 0)) {
|
2021-08-28 06:29:07 +00:00
|
|
|
throw new IllegalArgumentException(a.q("byteCount < 0: ", j).toString());
|
2021-08-03 07:33:18 +00:00
|
|
|
} else if (!(!this.j)) {
|
|
|
|
throw new IllegalStateException("closed".toString());
|
|
|
|
} else if (i == 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
s N = eVar.N(1);
|
2021-10-09 06:29:02 +00:00
|
|
|
int min = (int) Math.min(j, (long) (8192 - N.f2867c));
|
2021-08-03 07:33:18 +00:00
|
|
|
if (this.l.needsInput()) {
|
|
|
|
if (!this.k.v()) {
|
|
|
|
s sVar = this.k.g().i;
|
|
|
|
if (sVar == null) {
|
|
|
|
d0.z.d.m.throwNpe();
|
|
|
|
}
|
2021-10-09 06:29:02 +00:00
|
|
|
int i2 = sVar.f2867c;
|
2021-08-03 07:33:18 +00:00
|
|
|
int i3 = sVar.b;
|
|
|
|
int i4 = i2 - i3;
|
|
|
|
this.i = i4;
|
|
|
|
this.l.setInput(sVar.a, i3, i4);
|
|
|
|
}
|
|
|
|
}
|
2021-10-09 06:29:02 +00:00
|
|
|
int inflate = this.l.inflate(N.a, N.f2867c, min);
|
2021-08-03 07:33:18 +00:00
|
|
|
int i5 = this.i;
|
|
|
|
if (i5 != 0) {
|
|
|
|
int remaining = i5 - this.l.getRemaining();
|
|
|
|
this.i -= remaining;
|
|
|
|
this.k.skip((long) remaining);
|
|
|
|
}
|
|
|
|
if (inflate > 0) {
|
2021-10-09 06:29:02 +00:00
|
|
|
N.f2867c += inflate;
|
2021-08-03 07:33:18 +00:00
|
|
|
long j2 = (long) inflate;
|
|
|
|
eVar.j += j2;
|
|
|
|
return j2;
|
|
|
|
}
|
2021-10-09 06:29:02 +00:00
|
|
|
if (N.b == N.f2867c) {
|
2021-08-03 07:33:18 +00:00
|
|
|
eVar.i = N.a();
|
|
|
|
t.a(N);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
} catch (DataFormatException e) {
|
|
|
|
throw new IOException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.x, java.io.Closeable, java.lang.AutoCloseable
|
|
|
|
public void close() throws IOException {
|
|
|
|
if (!this.j) {
|
|
|
|
this.l.end();
|
|
|
|
this.j = true;
|
|
|
|
this.k.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.x
|
|
|
|
public long h0(e eVar, long j) throws IOException {
|
|
|
|
d0.z.d.m.checkParameterIsNotNull(eVar, "sink");
|
|
|
|
do {
|
|
|
|
long a = a(eVar, j);
|
|
|
|
if (a > 0) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
if (this.l.finished() || this.l.needsDictionary()) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} while (!this.k.v());
|
|
|
|
throw new EOFException("source exhausted prematurely");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.x
|
|
|
|
public y timeout() {
|
|
|
|
return this.k.timeout();
|
|
|
|
}
|
|
|
|
}
|