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

132 lines
4.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.ejbca.cvc.exception.ConstructionException;
/* loaded from: classes6.dex */
public abstract class glA extends AbstractC15245glT {
public final Map<glS, AbstractC15245glT> b;
private final List<glS> d;
protected abstract glS[] a();
public glA(glS gls) {
super(gls);
this.b = new HashMap();
this.d = Arrays.asList(a());
}
public void c(AbstractC15245glT abstractC15245glT) throws ConstructionException {
if (abstractC15245glT != null) {
if (this.d.contains(abstractC15245glT.b())) {
if (this.b.containsKey(abstractC15245glT.b())) {
StringBuilder sb = new StringBuilder("Field ");
sb.append(abstractC15245glT.b());
sb.append(" has already been added to ");
sb.append(getClass().getName());
throw new ConstructionException(sb.toString());
}
abstractC15245glT.c(this);
this.b.put(abstractC15245glT.b(), abstractC15245glT);
return;
}
StringBuilder sb2 = new StringBuilder("Field ");
sb2.append(abstractC15245glT.b());
sb2.append(" not allowed in ");
sb2.append(getClass().getName());
throw new ConstructionException(sb2.toString());
}
}
public final AbstractC15245glT e(glS gls) throws NoSuchFieldException {
AbstractC15245glT abstractC15245glT = this.b.get(gls);
if (abstractC15245glT != null) {
return abstractC15245glT;
}
throw new NoSuchFieldException("Could not find subfield ".concat(String.valueOf(gls)));
}
@Override // o.AbstractC15245glT
public final int e(DataOutputStream dataOutputStream) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream2 = new DataOutputStream(byteArrayOutputStream);
Iterator<AbstractC15245glT> it = c().iterator();
int i = 0;
while (it.hasNext()) {
i += it.next().e(dataOutputStream2);
}
dataOutputStream2.close();
int i2 = b().value;
int size = dataOutputStream.size();
dataOutputStream.write(d(Integer.valueOf(i2)));
dataOutputStream.write(c(i));
dataOutputStream.write(byteArrayOutputStream.toByteArray());
return dataOutputStream.size() - size;
}
protected List<AbstractC15245glT> c() {
return g();
}
public final byte[] d() throws IOException {
Throwable th;
ByteArrayOutputStream byteArrayOutputStream;
try {
byteArrayOutputStream = new ByteArrayOutputStream();
try {
e(new DataOutputStream(byteArrayOutputStream));
byteArrayOutputStream.close();
return byteArrayOutputStream.toByteArray();
} catch (Throwable th2) {
th = th2;
if (byteArrayOutputStream != null) {
byteArrayOutputStream.close();
}
throw th;
}
} catch (Throwable th3) {
th = th3;
byteArrayOutputStream = null;
}
}
@Override // o.AbstractC15245glT
public final String d(String str) {
return a(str, true);
}
@Override // o.AbstractC15245glT
public final String a(String str, boolean z) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(super.a(str, z));
for (AbstractC15245glT abstractC15245glT : g()) {
stringBuffer.append(a);
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(" ");
stringBuffer.append(abstractC15245glT.a(sb.toString(), z));
}
return stringBuffer.toString();
}
private List<AbstractC15245glT> g() {
ArrayList arrayList = new ArrayList();
Iterator<glS> it = this.d.iterator();
while (it.hasNext()) {
AbstractC15245glT abstractC15245glT = this.b.get(it.next());
if (abstractC15245glT != null) {
arrayList.add(abstractC15245glT);
}
}
return arrayList;
}
}