package p421.p433.p434.p439.p440;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import p421.p433.p434.p442.C6822;
import p421.p433.p434.p442.p443.EnumC6836;

/* JADX INFO: renamed from: ޏ.ؠ.֏.ށ.֏.ޅ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC6797 extends InputStream {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public RandomAccessFile f19672;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public File f19673;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public boolean f19674;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public int f19675;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public byte[] f19676 = new byte[1];

    public AbstractC6797(File file, boolean z, int i) {
        this.f19675 = 0;
        this.f19672 = new RandomAccessFile(file, EnumC6836.READ.f19843);
        this.f19673 = file;
        this.f19674 = z;
        if (z) {
            this.f19675 = i;
        }
    }

    @Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
    public void close() throws IOException {
        RandomAccessFile randomAccessFile = this.f19672;
        if (randomAccessFile != null) {
            randomAccessFile.close();
        }
    }

    @Override // java.io.InputStream
    public int read() {
        if (read(this.f19676) == -1) {
            return -1;
        }
        return this.f19676[0];
    }

    @Override // java.io.InputStream
    public int read(byte[] bArr) {
        return read(bArr, 0, bArr.length);
    }

    @Override // java.io.InputStream
    public int read(byte[] bArr, int i, int i2) throws IOException {
        int i3 = this.f19672.read(bArr, i, i2);
        if ((i3 == i2 && i3 != -1) || !this.f19674) {
            return i3;
        }
        m9966(this.f19675 + 1);
        this.f19675++;
        if (i3 < 0) {
            i3 = 0;
        }
        int i4 = this.f19672.read(bArr, i3, i2 - i3);
        return i4 > 0 ? i3 + i4 : i3;
    }

    /* JADX INFO: renamed from: ֏ */
    public abstract File mo9963(int i);

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m9965(C6822 c6822) throws IOException {
        if (this.f19674) {
            int i = this.f19675;
            int i2 = c6822.f19762;
            if (i != i2) {
                m9966(i2);
                this.f19675 = c6822.f19762;
            }
        }
        this.f19672.seek(c6822.f19764);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public void m9966(int i) throws IOException {
        File fileMo9963 = mo9963(i);
        if (fileMo9963.exists()) {
            this.f19672.close();
            this.f19672 = new RandomAccessFile(fileMo9963, EnumC6836.READ.f19843);
        } else {
            throw new FileNotFoundException("zip split file does not exist: " + fileMo9963);
        }
    }
}
