package com.bumptech.glide.load.data;

import android.content.res.AssetManager;
import android.util.Log;
import com.bumptech.glide.load.data.d;
import java.io.IOException;

/* loaded from: classes4.dex */
public abstract class b implements d {

    /* renamed from: p, reason: collision with root package name */
    private final String f12577p;

    /* renamed from: q, reason: collision with root package name */
    private final AssetManager f12578q;

    /* renamed from: r, reason: collision with root package name */
    private Object f12579r;

    public b(AssetManager assetManager, String str) {
        this.f12578q = assetManager;
        this.f12577p = str;
    }

    @Override // com.bumptech.glide.load.data.d
    public void b() {
        Object obj = this.f12579r;
        if (obj == null) {
            return;
        }
        try {
            c(obj);
        } catch (IOException unused) {
        }
    }

    protected abstract void c(Object obj);

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

    @Override // com.bumptech.glide.load.data.d
    public jh.a d() {
        return jh.a.LOCAL;
    }

    @Override // com.bumptech.glide.load.data.d
    public void e(com.bumptech.glide.g gVar, d.a aVar) {
        try {
            Object f10 = f(this.f12578q, this.f12577p);
            this.f12579r = f10;
            aVar.f(f10);
        } catch (IOException e10) {
            if (Log.isLoggable("AssetPathFetcher", 3)) {
                Log.d("AssetPathFetcher", "Failed to load data from asset manager", e10);
            }
            aVar.c(e10);
        }
    }

    protected abstract Object f(AssetManager assetManager, String str);
}
