what-the-bank/sources/o/C15158gim.java

103 lines
3.1 KiB
Java

package o;
import java.io.EOFException;
import java.io.IOException;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
/* renamed from: o.gim, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C15158gim implements giD {
private int a;
private boolean b;
private final InterfaceC15149gid c;
private final Inflater d;
public C15158gim(InterfaceC15149gid interfaceC15149gid, Inflater inflater) {
C14957gcv.e(interfaceC15149gid, "");
C14957gcv.e(inflater, "");
this.c = interfaceC15149gid;
this.d = inflater;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public C15158gim(giD gid, Inflater inflater) {
this(C15160gio.c(gid), inflater);
C14957gcv.e(gid, "");
C14957gcv.e(inflater, "");
}
@Override // o.giD
public final long read(C15111ghZ c15111ghZ, long j) throws IOException {
C14957gcv.e(c15111ghZ, "");
do {
long d = d(c15111ghZ, j);
if (d > 0) {
return d;
}
if (this.d.finished() || this.d.needsDictionary()) {
return -1L;
}
} while (!this.c.j());
throw new EOFException("source exhausted prematurely");
}
public final long d(C15111ghZ c15111ghZ, long j) throws IOException {
C14957gcv.e(c15111ghZ, "");
if (j < 0) {
throw new IllegalArgumentException("byteCount < 0: ".concat(String.valueOf(j)).toString());
}
if (!(!this.b)) {
throw new IllegalStateException("closed".toString());
}
if (j == 0) {
return 0L;
}
try {
C15170giy d = c15111ghZ.d(1);
int min = (int) Math.min(j, 8192 - d.d);
if (this.d.needsInput() && !this.c.j()) {
C15170giy c15170giy = this.c.i().d;
C14957gcv.e(c15170giy);
this.a = c15170giy.d - c15170giy.e;
this.d.setInput(c15170giy.c, c15170giy.e, this.a);
}
int inflate = this.d.inflate(d.c, d.d, min);
int i = this.a;
if (i != 0) {
int remaining = i - this.d.getRemaining();
this.a -= remaining;
this.c.j(remaining);
}
if (inflate > 0) {
d.d += inflate;
long j2 = inflate;
c15111ghZ.c += j2;
return j2;
}
if (d.e == d.d) {
c15111ghZ.d = d.d();
C15169gix.e(d);
}
return 0L;
} catch (DataFormatException e) {
throw new IOException(e);
}
}
@Override // o.giD
public final C15139giB timeout() {
return this.c.timeout();
}
@Override // o.giD, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
if (this.b) {
return;
}
this.d.end();
this.b = true;
this.c.close();
}
}