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

123 lines
3.4 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.io.IOException;
import java.util.zip.Deflater;
/* renamed from: o.gih, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C15153gih implements InterfaceC15168giw {
private final InterfaceC15148gic b;
private final Deflater c;
private boolean d;
private C15153gih(InterfaceC15148gic interfaceC15148gic, Deflater deflater) {
C14957gcv.e(interfaceC15148gic, "");
C14957gcv.e(deflater, "");
this.b = interfaceC15148gic;
this.c = deflater;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public C15153gih(InterfaceC15168giw interfaceC15168giw, Deflater deflater) {
this(C15160gio.c(interfaceC15168giw), deflater);
C14957gcv.e(interfaceC15168giw, "");
C14957gcv.e(deflater, "");
}
private final void e(boolean z) {
C15170giy d;
int deflate;
C15111ghZ i = this.b.i();
while (true) {
d = i.d(1);
if (z) {
deflate = this.c.deflate(d.c, d.d, 8192 - d.d, 2);
} else {
deflate = this.c.deflate(d.c, d.d, 8192 - d.d);
}
if (deflate > 0) {
d.d += deflate;
i.c += deflate;
this.b.b();
} else if (this.c.needsInput()) {
break;
}
}
if (d.e == d.d) {
i.d = d.d();
C15169gix.e(d);
}
}
@Override // o.InterfaceC15168giw, java.io.Flushable
public final void flush() throws IOException {
e(true);
this.b.flush();
}
@Override // o.InterfaceC15168giw, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
if (this.d) {
return;
}
try {
this.c.finish();
e(false);
th = null;
} catch (Throwable th) {
th = th;
}
try {
this.c.end();
} catch (Throwable th2) {
if (th == null) {
th = th2;
}
}
try {
this.b.close();
} catch (Throwable th3) {
if (th == null) {
th = th3;
}
}
this.d = true;
if (th != null) {
throw th;
}
}
@Override // o.InterfaceC15168giw
public final C15139giB timeout() {
return this.b.timeout();
}
public final String toString() {
StringBuilder sb = new StringBuilder("DeflaterSink(");
sb.append(this.b);
sb.append(')');
return sb.toString();
}
@Override // o.InterfaceC15168giw
public final void write(C15111ghZ c15111ghZ, long j) throws IOException {
C14957gcv.e(c15111ghZ, "");
giE.d(c15111ghZ.c, 0L, j);
while (j > 0) {
C15170giy c15170giy = c15111ghZ.d;
C14957gcv.e(c15170giy);
int min = (int) Math.min(j, c15170giy.d - c15170giy.e);
this.c.setInput(c15170giy.c, c15170giy.e, min);
e(false);
long j2 = min;
c15111ghZ.c -= j2;
c15170giy.e += min;
if (c15170giy.e == c15170giy.d) {
c15111ghZ.d = c15170giy.d();
C15169gix.e(c15170giy);
}
j -= j2;
}
}
}