108 lines
2.9 KiB
Java
108 lines
2.9 KiB
Java
|
package com.facetec.sdk;
|
||
|
|
||
|
import java.io.EOFException;
|
||
|
import java.io.IOException;
|
||
|
import java.util.zip.DataFormatException;
|
||
|
import java.util.zip.Inflater;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class mx implements nk {
|
||
|
private int a;
|
||
|
private final mr b;
|
||
|
private final Inflater d;
|
||
|
private boolean e;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public mx(mr mrVar, Inflater inflater) {
|
||
|
if (mrVar == null) {
|
||
|
throw new IllegalArgumentException("source == null");
|
||
|
}
|
||
|
if (inflater == null) {
|
||
|
throw new IllegalArgumentException("inflater == null");
|
||
|
}
|
||
|
this.b = mrVar;
|
||
|
this.d = inflater;
|
||
|
}
|
||
|
|
||
|
@Override // com.facetec.sdk.nk
|
||
|
public final long b(ms msVar, long j) throws IOException {
|
||
|
boolean d;
|
||
|
if (j < 0) {
|
||
|
throw new IllegalArgumentException("byteCount < 0: ".concat(String.valueOf(j)));
|
||
|
}
|
||
|
if (this.e) {
|
||
|
throw new IllegalStateException("closed");
|
||
|
}
|
||
|
if (j == 0) {
|
||
|
return 0L;
|
||
|
}
|
||
|
do {
|
||
|
d = d();
|
||
|
try {
|
||
|
nc a = msVar.a(1);
|
||
|
int inflate = this.d.inflate(a.b, a.a, (int) Math.min(j, 8192 - a.a));
|
||
|
if (inflate > 0) {
|
||
|
a.a += inflate;
|
||
|
long j2 = inflate;
|
||
|
msVar.e += j2;
|
||
|
return j2;
|
||
|
}
|
||
|
if (!this.d.finished() && !this.d.needsDictionary()) {
|
||
|
}
|
||
|
a();
|
||
|
if (a.e != a.a) {
|
||
|
return -1L;
|
||
|
}
|
||
|
msVar.b = a.b();
|
||
|
nf.a(a);
|
||
|
return -1L;
|
||
|
} catch (DataFormatException e) {
|
||
|
throw new IOException(e);
|
||
|
}
|
||
|
} while (!d);
|
||
|
throw new EOFException("source exhausted prematurely");
|
||
|
}
|
||
|
|
||
|
private boolean d() throws IOException {
|
||
|
if (!this.d.needsInput()) {
|
||
|
return false;
|
||
|
}
|
||
|
a();
|
||
|
if (this.d.getRemaining() != 0) {
|
||
|
throw new IllegalStateException("?");
|
||
|
}
|
||
|
if (this.b.a()) {
|
||
|
return true;
|
||
|
}
|
||
|
nc ncVar = this.b.d().b;
|
||
|
this.a = ncVar.a - ncVar.e;
|
||
|
this.d.setInput(ncVar.b, ncVar.e, this.a);
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
private void a() throws IOException {
|
||
|
int i = this.a;
|
||
|
if (i == 0) {
|
||
|
return;
|
||
|
}
|
||
|
int remaining = i - this.d.getRemaining();
|
||
|
this.a -= remaining;
|
||
|
this.b.f(remaining);
|
||
|
}
|
||
|
|
||
|
@Override // com.facetec.sdk.nk
|
||
|
public final nh b() {
|
||
|
return this.b.b();
|
||
|
}
|
||
|
|
||
|
@Override // com.facetec.sdk.nk, java.io.Closeable, java.lang.AutoCloseable
|
||
|
public final void close() throws IOException {
|
||
|
if (this.e) {
|
||
|
return;
|
||
|
}
|
||
|
this.d.end();
|
||
|
this.e = true;
|
||
|
this.b.close();
|
||
|
}
|
||
|
}
|