package com.bytedance.sdk.openadsdk.ro;

import com.bytedance.sdk.component.utils.wsy;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/* JADX INFO: loaded from: classes2.dex */
public abstract class fm {
    protected boolean fm = false;
    private final ExecutorService ro = Executors.newSingleThreadExecutor();

    /* JADX INFO: renamed from: com.bytedance.sdk.openadsdk.ro.fm$fm, reason: collision with other inner class name */
    public class CallableC0106fm implements Callable<Void> {
        private final File ro;

        @Override // java.util.concurrent.Callable
        /* JADX INFO: renamed from: fm, reason: merged with bridge method [inline-methods] */
        public Void call() throws Exception {
            fm.this.ro(this.ro);
            return null;
        }

        private CallableC0106fm(File file) {
            this.ro = file;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void ro(File file) throws IOException {
        if (!this.fm) {
            try {
                wsy.ro(file);
            } catch (Throwable unused) {
            }
            fm(wsy.fm(file.getParentFile()));
        } else {
            List<File> listFm = wsy.fm(file);
            listFm.toString();
            fm(listFm);
        }
    }

    public abstract void fm(List<File> list);

    public abstract boolean fm(long j10, int i10);

    public abstract boolean fm(File file, long j10, int i10);

    public void fm(File file) throws IOException {
        this.ro.submit(new CallableC0106fm(file));
    }

    public long ro(List<File> list) {
        Iterator<File> it = list.iterator();
        long length = 0;
        while (it.hasNext()) {
            length += it.next().length();
        }
        return length;
    }
}
