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

124 lines
3.7 KiB
Java

package o;
import android.util.Base64;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import o.InterfaceC12232euN;
import o.SCe;
/* loaded from: classes.dex */
public final class sOU<Model, Data> implements SCe<Model, Data> {
private final HBt<Data> e;
/* loaded from: classes.dex */
public interface HBt<Data> {
Data c(String str) throws IllegalArgumentException;
Class<Data> e();
void e(Data data) throws IOException;
}
public sOU(HBt<Data> hBt) {
this.e = hBt;
}
@Override // o.SCe
public final SCe.IeS<Data> e(Model model, int i, int i2, unA una) {
return new SCe.IeS<>(new xBn(model), new LWm(model.toString(), this.e));
}
@Override // o.SCe
public final boolean d(Model model) {
return model.toString().startsWith("data:image");
}
/* loaded from: classes.dex */
static final class LWm<Data> implements InterfaceC12232euN<Data> {
private final HBt<Data> b;
private Data c;
private final String d;
@Override // o.InterfaceC12232euN
public final void a() {
}
LWm(String str, HBt<Data> hBt) {
this.d = str;
this.b = hBt;
}
/* JADX WARN: Type inference failed for: r2v3, types: [java.lang.Object, Data] */
@Override // o.InterfaceC12232euN
public final void c(EnumC3495ayd enumC3495ayd, InterfaceC12232euN.IeS<? super Data> ieS) {
try {
Data c = this.b.c(this.d);
this.c = c;
ieS.a((InterfaceC12232euN.IeS<? super Data>) c);
} catch (IllegalArgumentException e) {
ieS.a((Exception) e);
}
}
@Override // o.InterfaceC12232euN
public final void e() {
try {
this.b.e(this.c);
} catch (IOException unused) {
}
}
@Override // o.InterfaceC12232euN
public final Class<Data> c() {
return this.b.e();
}
@Override // o.InterfaceC12232euN
public final pNW d() {
return pNW.LOCAL;
}
}
/* loaded from: classes.dex */
public static final class IeS<Model> implements rIx<Model, InputStream> {
private final HBt<InputStream> b = new HBt<InputStream>(this) { // from class: o.sOU.IeS.3
private IeS b;
{
this.b = this;
}
@Override // o.sOU.HBt
public final /* synthetic */ void e(InputStream inputStream) throws IOException {
inputStream.close();
}
@Override // o.sOU.HBt
public final Class<InputStream> e() {
return InputStream.class;
}
@Override // o.sOU.HBt
public final /* synthetic */ InputStream c(String str) throws IllegalArgumentException {
if (!str.startsWith("data:image")) {
throw new IllegalArgumentException("Not a valid image data URL.");
}
int indexOf = str.indexOf(44);
if (indexOf == -1) {
throw new IllegalArgumentException("Missing comma in data URL.");
}
if (!str.substring(0, indexOf).endsWith(";base64")) {
throw new IllegalArgumentException("Not a base64 image data URL.");
}
return new ByteArrayInputStream(Base64.decode(str.substring(indexOf + 1), 0));
}
};
@Override // o.rIx
public final SCe<Model, InputStream> c(Vzp vzp) {
return new sOU(this.b);
}
}
}