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

168 lines
5.6 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import com.google.firebase.crashlytics.internal.common.AbstractSpiCall;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import org.jmrtd.lds.ImageInfo;
/* loaded from: classes6.dex */
public final class gkT implements Serializable {
private final gkS[] a;
public final String c;
public final Charset d;
static {
gkT b = b("application/atom+xml", gkR.d);
gkT b2 = b("application/x-www-form-urlencoded", gkR.d);
gkT b3 = b(AbstractSpiCall.ACCEPT_JSON_VALUE, gkR.c);
b("application/octet-stream", (Charset) null);
gkT b4 = b("application/svg+xml", gkR.d);
gkT b5 = b("application/xhtml+xml", gkR.d);
gkT b6 = b("application/xml", gkR.d);
gkT b7 = b("image/bmp", (Charset) null);
gkT b8 = b("image/gif", (Charset) null);
gkT b9 = b(ImageInfo.JPEG_MIME_TYPE, (Charset) null);
gkT b10 = b("image/png", (Charset) null);
gkT b11 = b("image/svg+xml", (Charset) null);
gkT b12 = b("image/tiff", (Charset) null);
gkT b13 = b("image/webp", (Charset) null);
gkT b14 = b("multipart/form-data", gkR.d);
gkT b15 = b("text/html", gkR.d);
gkT b16 = b("text/plain", gkR.d);
gkT b17 = b("text/xml", gkR.d);
b("*/*", (Charset) null);
gkT[] gktArr = {b, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17};
HashMap hashMap = new HashMap();
for (int i = 0; i < 17; i++) {
gkT gkt = gktArr[i];
hashMap.put(gkt.c, gkt);
}
Collections.unmodifiableMap(hashMap);
}
private gkT(String str, Charset charset) {
this.c = str;
this.d = charset;
this.a = null;
}
private gkT(String str, Charset charset, gkS[] gksArr) {
this.c = str;
this.d = charset;
this.a = gksArr;
}
public final String toString() {
int i;
C15262glq c15262glq = new C15262glq(64);
c15262glq.b(this.c);
if (this.a != null) {
c15262glq.b("; ");
C15256glk c15256glk = C15256glk.c;
gkS[] gksArr = this.a;
C15264gls.c(gksArr, "Header parameter array");
if (gksArr == null || gksArr.length <= 0) {
i = 0;
} else {
i = (gksArr.length - 1) << 1;
for (gkS gks : gksArr) {
i += C15256glk.e(gks);
}
}
c15262glq.c(i);
for (int i2 = 0; i2 < gksArr.length; i2++) {
if (i2 > 0) {
c15262glq.b("; ");
}
gkS gks2 = gksArr[i2];
C15264gls.c(gks2, "Name / value pair");
c15262glq.c(C15256glk.e(gks2));
c15262glq.b(gks2.c());
String e = gks2.e();
if (e != null) {
c15262glq.a('=');
boolean z = false;
for (int i3 = 0; i3 < e.length() && !z; i3++) {
z = " ;,:@()<>\\\"/[]?={}\t".indexOf(e.charAt(i3)) >= 0;
}
if (z) {
c15262glq.a('\"');
}
for (int i4 = 0; i4 < e.length(); i4++) {
char charAt = e.charAt(i4);
if ("\"\\".indexOf(charAt) >= 0) {
c15262glq.a('\\');
}
c15262glq.a(charAt);
}
if (z) {
c15262glq.a('\"');
}
}
}
} else if (this.d != null) {
c15262glq.b("; charset=");
c15262glq.b(this.d.name());
}
return c15262glq.toString();
}
private static boolean d(String str) {
for (int i = 0; i < str.length(); i++) {
char charAt = str.charAt(i);
if (charAt == '\"' || charAt == ',' || charAt == ';') {
return false;
}
}
return true;
}
public static gkT b(String str, Charset charset) {
String lowerCase = ((String) C15264gls.e(str, "MIME type")).toLowerCase(Locale.ROOT);
if (d(lowerCase)) {
return new gkT(lowerCase, charset);
}
throw new IllegalArgumentException("MIME type may not contain reserved characters");
}
public static gkT a(String str) {
return b(str, (Charset) null);
}
private static gkT d(String str, gkS[] gksArr) {
Charset charset;
int length = gksArr.length;
int i = 0;
while (true) {
if (i >= length) {
break;
}
gkS gks = gksArr[i];
if (gks.c().equalsIgnoreCase("charset")) {
String e = gks.e();
if (!C15270gly.c(e)) {
charset = Charset.forName(e);
}
} else {
i++;
}
}
charset = null;
if (gksArr == null || gksArr.length <= 0) {
gksArr = null;
}
return new gkT(str, charset, gksArr);
}
public static gkT b(String str, gkS... gksArr) throws UnsupportedCharsetException {
if (d(((String) C15264gls.e(str, "MIME type")).toLowerCase(Locale.ROOT))) {
return d(str, gksArr);
}
throw new IllegalArgumentException("MIME type may not contain reserved characters");
}
}