package g5;

import com.bumptech.glide.Priority;
import com.bumptech.glide.load.DataSource;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/* JADX INFO: loaded from: classes.dex */
public final class j implements com.bumptech.glide.load.data.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f26192a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Object f26193b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Object f26194c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f26195d;

    public /* synthetic */ j(Object obj, Object obj2, int i10) {
        this.f26192a = i10;
        this.f26194c = obj;
        this.f26195d = obj2;
    }

    @Override // com.bumptech.glide.load.data.e
    public final Class a() {
        int i10 = this.f26192a;
        Object obj = this.f26195d;
        switch (i10) {
            case 0:
                ((xyz.stream.api.a0) obj).getClass();
                return InputStream.class;
            default:
                return ((n) obj).a();
        }
    }

    @Override // com.bumptech.glide.load.data.e
    public final void b() {
        int i10 = this.f26192a;
        Object obj = this.f26195d;
        switch (i10) {
            case 0:
                try {
                    Object obj2 = this.f26193b;
                    ((xyz.stream.api.a0) obj).getClass();
                    ((InputStream) obj2).close();
                } catch (IOException unused) {
                    return;
                }
                break;
            default:
                Object obj3 = this.f26193b;
                if (obj3 != null) {
                    try {
                        ((n) obj).n(obj3);
                    } catch (IOException unused2) {
                        return;
                    }
                }
                break;
        }
    }

    @Override // com.bumptech.glide.load.data.e
    public final void cancel() {
    }

    @Override // com.bumptech.glide.load.data.e
    public final DataSource d() {
        return DataSource.f5589a;
    }

    @Override // com.bumptech.glide.load.data.e
    public final void e(Priority priority, com.bumptech.glide.load.data.d dVar) {
        int i10 = this.f26192a;
        Object obj = this.f26194c;
        Object obj2 = this.f26195d;
        switch (i10) {
            case 0:
                try {
                    ((xyz.stream.api.a0) obj2).getClass();
                    ByteArrayInputStream byteArrayInputStreamG = xyz.stream.api.a0.g((String) obj);
                    this.f26193b = byteArrayInputStreamG;
                    dVar.onDataReady(byteArrayInputStreamG);
                } catch (IllegalArgumentException e10) {
                    dVar.c(e10);
                }
                break;
            default:
                try {
                    Object objH = ((n) obj2).h((File) obj);
                    this.f26193b = objH;
                    dVar.onDataReady(objH);
                } catch (FileNotFoundException e11) {
                    dVar.c(e11);
                    return;
                }
                break;
        }
    }
}
