e.java 源代码


package w0;

import android.util.Log;
import java.io.File;
import java.io.IOException;
import p0.a;
import w0.a;

public class e implements a {

    private static e f27326f;

    private final c f27327a = new c();

    private final j f27328b = new j();

    private final File f27329c;

    private final int f27330d;

    private p0.a f27331e;

    protected e(File file, int i6) {
        this.f27329c = file;
        this.f27330d = i6;
    }

    public static synchronized a c(File file, int i6) {
        e eVar;
        synchronized (e.class) {
            if (f27326f == null) {
                f27326f = new e(file, i6);
            }
            eVar = f27326f;
        }
        return eVar;
    }

    private synchronized p0.a d() throws IOException {
        if (this.f27331e == null) {
            this.f27331e = p0.a.u(this.f27329c, 1, 1, this.f27330d);
        }
        return this.f27331e;
    }

    @Override
    public void a(s0.c cVar, a.b bVar) {
        String a7 = this.f27328b.a(cVar);
        this.f27327a.a(cVar);
        try {
            try {
                a.b q6 = d().q(a7);
                if (q6 != null) {
                    try {
                        if (bVar.a(q6.f(0))) {
                            q6.e();
                        }
                        q6.b();
                    } catch (Throwable th) {
                        q6.b();
                        throw th;
                    }
                }
            } catch (IOException e6) {
                if (Log.isLoggable("DiskLruCacheWrapper", 5)) {
                    Log.w("DiskLruCacheWrapper", "Unable to put to disk cache", e6);
                }
            }
        } finally {
            this.f27327a.b(cVar);
        }
    }

    @Override
    public File b(s0.c cVar) {
        try {
            a.d s6 = d().s(this.f27328b.a(cVar));
            if (s6 == null) {
                return null;
            }
            return s6.a(0);
        } catch (IOException e6) {
            if (!Log.isLoggable("DiskLruCacheWrapper", 5)) {
                return null;
            }
            Log.w("DiskLruCacheWrapper", "Unable to get from disk cache", e6);
            return null;
        }
    }

    @Override
    public void delete(s0.c cVar) {
        try {
            d().z(this.f27328b.a(cVar));
        } catch (IOException e6) {
            if (Log.isLoggable("DiskLruCacheWrapper", 5)) {
                Log.w("DiskLruCacheWrapper", "Unable to delete from disk cache", e6);
            }
        }
    }
}