what-the-bank/sources/okhttp3/repackaged/internal/framed/c.java

105 lines
3.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package okhttp3.repackaged.internal.framed;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
import o.C15144giU;
import o.C15145giV;
import o.InterfaceC15142giR;
import o.giM;
import o.giP;
import o.giS;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public class c {
private final C15144giU akH;
private int akI;
private final InterfaceC15142giR source;
public c(InterfaceC15142giR interfaceC15142giR) {
C15144giU c15144giU = new C15144giU(new giS(this, interfaceC15142giR) { // from class: okhttp3.repackaged.internal.framed.c.1
final c akJ;
{
this.akJ = this;
}
@Override // o.giS, o.giZ
public long read(giM gim, long j) throws IOException {
if (this.akJ.akI == 0) {
return -1L;
}
long read = super.read(gim, Math.min(j, this.akJ.akI));
if (read == -1) {
return -1L;
}
this.akJ.akI = (int) (r8.akI - read);
return read;
}
}, new Inflater(this) { // from class: okhttp3.repackaged.internal.framed.c.2
final c akJ;
{
this.akJ = this;
}
@Override // java.util.zip.Inflater
public int inflate(byte[] bArr, int i, int i2) throws DataFormatException {
int inflate = super.inflate(bArr, i, i2);
if (inflate != 0 || !needsDictionary()) {
return inflate;
}
setDictionary(Spdy3.aln);
return super.inflate(bArr, i, i2);
}
});
this.akH = c15144giU;
this.source = C15145giV.a(c15144giU);
}
public List<Header> F(int i) throws IOException {
this.akI += i;
int k = this.source.k();
if (k < 0) {
throw new IOException("numberOfPairs < 0: ".concat(String.valueOf(k)));
}
if (k > 1024) {
throw new IOException("numberOfPairs > 1024: ".concat(String.valueOf(k)));
}
ArrayList arrayList = new ArrayList(k);
for (int i2 = 0; i2 < k; i2++) {
giP c = readByteString().c();
giP readByteString = readByteString();
if (c.d.length == 0) {
throw new IOException("name.size == 0");
}
arrayList.add(new Header(c, readByteString));
}
uQ();
return arrayList;
}
private giP readByteString() throws IOException {
return this.source.e(this.source.k());
}
private void uQ() throws IOException {
if (this.akI > 0) {
this.akH.c();
if (this.akI == 0) {
return;
}
StringBuilder sb = new StringBuilder("compressedLimit > 0: ");
sb.append(this.akI);
throw new IOException(sb.toString());
}
}
public void close() throws IOException {
this.source.close();
}
}