what-the-bank/sources/com/facetec/sdk/fg.java

64 lines
1.9 KiB
Java

package com.facetec.sdk;
import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Type;
import java.util.ArrayList;
/* loaded from: classes.dex */
public final class fg<E> extends ek<Object> {
public static final en a = new en() { // from class: com.facetec.sdk.fg.4
@Override // com.facetec.sdk.en
public final <T> ek<T> e(dx dxVar, fv<T> fvVar) {
Type b = fvVar.b();
if (!(b instanceof GenericArrayType) && (!(b instanceof Class) || !((Class) b).isArray())) {
return null;
}
Type a2 = et.a(b);
return new fg(dxVar, dxVar.d(fv.b(a2)), et.e(a2));
}
};
private final Class<E> b;
private final ek<E> c;
public fg(dx dxVar, ek<E> ekVar, Class<E> cls) {
this.c = new fq(dxVar, ekVar, cls);
this.b = cls;
}
@Override // com.facetec.sdk.ek
public final Object a(fu fuVar) throws IOException {
if (fuVar.i() == gc.NULL) {
fuVar.l();
return null;
}
ArrayList arrayList = new ArrayList();
fuVar.a();
while (fuVar.e()) {
arrayList.add(this.c.a(fuVar));
}
fuVar.c();
int size = arrayList.size();
Object newInstance = Array.newInstance((Class<?>) this.b, size);
for (int i = 0; i < size; i++) {
Array.set(newInstance, i, arrayList.get(i));
}
return newInstance;
}
@Override // com.facetec.sdk.ek
public final void b(ga gaVar, Object obj) throws IOException {
if (obj == null) {
gaVar.h();
return;
}
gaVar.e();
int length = Array.getLength(obj);
for (int i = 0; i < length; i++) {
this.c.b(gaVar, Array.get(obj, i));
}
gaVar.b();
}
}