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

89 lines
3.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* renamed from: o.yld, reason: case insensitive filesystem */
/* loaded from: classes2.dex */
public final class C17668yld {
private static final List<CharsetEncoder> d = new ArrayList();
public final int c;
public final CharsetEncoder[] e;
static {
String[] strArr = {"IBM437", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-11", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "ISO-8859-16", "windows-1250", "windows-1251", "windows-1252", "windows-1256", "Shift_JIS"};
for (int i = 0; i < 20; i++) {
String str = strArr[i];
if (EnumC0626KzG.e(str) != null) {
try {
d.add(Charset.forName(str).newEncoder());
} catch (UnsupportedCharsetException unused) {
}
}
}
}
public C17668yld(String str, Charset charset, int i) {
boolean z;
ArrayList<CharsetEncoder> arrayList = new ArrayList();
arrayList.add(StandardCharsets.ISO_8859_1.newEncoder());
int i2 = 0;
boolean z2 = charset != null && charset.name().startsWith("UTF");
for (int i3 = 0; i3 < str.length(); i3++) {
for (CharsetEncoder charsetEncoder : arrayList) {
char charAt = str.charAt(i3);
if (charAt == i || charsetEncoder.canEncode(charAt)) {
z = true;
break;
}
}
z = false;
if (!z) {
for (CharsetEncoder charsetEncoder2 : d) {
if (charsetEncoder2.canEncode(str.charAt(i3))) {
arrayList.add(charsetEncoder2);
break;
}
}
}
if (!z) {
z2 = true;
}
}
if (arrayList.size() == 1 && !z2) {
this.e = new CharsetEncoder[]{(CharsetEncoder) arrayList.get(0)};
} else {
this.e = new CharsetEncoder[arrayList.size() + 2];
Iterator it = arrayList.iterator();
int i4 = 0;
while (it.hasNext()) {
this.e[i4] = (CharsetEncoder) it.next();
i4++;
}
this.e[i4] = StandardCharsets.UTF_8.newEncoder();
this.e[i4 + 1] = StandardCharsets.UTF_16BE.newEncoder();
}
if (charset != null) {
while (true) {
CharsetEncoder[] charsetEncoderArr = this.e;
if (i2 >= charsetEncoderArr.length) {
break;
}
if (charsetEncoderArr[i2] != null && charset.name().equals(this.e[i2].charset().name())) {
break;
} else {
i2++;
}
}
this.c = i2;
}
i2 = -1;
this.c = i2;
}
}