package com.bykv.vk.openvk.preload.falconx.loader;

import android.content.Context;
import android.text.TextUtils;
import com.bykv.vk.openvk.preload.geckox.e.b;
import java.io.File;
import java.io.InputStream;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

/* JADX INFO: loaded from: classes.dex */
public class a implements ILoader {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private b f5973a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private AtomicBoolean f5974b = new AtomicBoolean(false);

    public a(Context context, String str, File file) {
        if (context == null) {
            throw new RuntimeException("context == null");
        }
        if (TextUtils.isEmpty(str)) {
            throw new RuntimeException("access key empty");
        }
        if (file == null) {
            throw new RuntimeException("resRootDir == null");
        }
        this.f5973a = new b(context, str, file);
    }

    public final int a(String str) throws Exception {
        if (this.f5974b.get()) {
            throw new RuntimeException("released!");
        }
        return this.f5973a.b(str);
    }

    @Override // com.bykv.vk.openvk.preload.falconx.loader.ILoader
    public boolean exist(String str) throws Exception {
        if (this.f5974b.get()) {
            throw new RuntimeException("released!");
        }
        return this.f5973a.c(str);
    }

    @Override // com.bykv.vk.openvk.preload.falconx.loader.ILoader
    public Map<String, Long> getChannelVersion() {
        return this.f5973a.b();
    }

    @Override // com.bykv.vk.openvk.preload.falconx.loader.ILoader
    public InputStream getInputStream(String str) throws Exception {
        if (this.f5974b.get()) {
            throw new RuntimeException("released!");
        }
        return this.f5973a.a(str);
    }

    @Override // com.bykv.vk.openvk.preload.falconx.loader.ILoader
    public String getResRootDir() {
        return this.f5973a.a();
    }

    @Override // com.bykv.vk.openvk.preload.falconx.loader.ILoader
    public void release() throws Exception {
        if (this.f5974b.getAndSet(true)) {
            return;
        }
        this.f5973a.c();
    }
}
