package p421.p433.p434.p439.p440;

import java.io.IOException;
import java.io.InputStream;
import net.lingala.zip4j.exception.ZipException;
import p138.p176.p177.p242.p246.p251.C4303;
import p421.p433.p434.p435.InterfaceC6774;
import p421.p433.p434.p442.C6815;
import p421.p433.p434.p442.C6823;
import p421.p433.p434.p442.p443.EnumC6834;

/* JADX INFO: renamed from: ޏ.ؠ.֏.ށ.֏.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC6790<T extends InterfaceC6774> extends InputStream {

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

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

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public byte[] f19657;

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

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public C6823 f19659;

    public AbstractC6790(C6799 c6799, C6823 c6823, char[] cArr) throws ZipException {
        this.f19655 = c6799;
        this.f19656 = (T) mo9957(c6823, cArr);
        this.f19659 = c6823;
        EnumC6834 enumC6834 = c6823.f19729;
        if (enumC6834 == EnumC6834.AES_INTERNAL_ONLY) {
            C6815 c6815 = c6823.f19742;
            if (c6815 == null) {
                throw new ZipException("AesExtraDataRecord not present in localheader for aes encrypted data");
            }
            enumC6834 = c6815.f19726;
        }
        if (enumC6834 == EnumC6834.DEFLATE) {
            this.f19657 = new byte[4096];
        }
    }

    @Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
    public void close() throws IOException {
        this.f19655.f19677.close();
    }

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

    @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 iM6983 = C4303.m6983(this.f19655, bArr, i, i2);
        if (iM6983 > 0) {
            byte[] bArr2 = this.f19657;
            if (bArr2 != null) {
                System.arraycopy(bArr, 0, bArr2, 0, iM6983);
            }
            this.f19656.mo9932(bArr, i, iM6983);
        }
        return iM6983;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public int m9960(byte[] bArr) throws IOException {
        C6799 c6799 = this.f19655;
        int i = c6799.f19677.read(bArr);
        if (i != bArr.length) {
            int length = bArr.length - i;
            int i2 = 0;
            for (int i3 = 0; i < bArr.length && i2 != -1 && i3 < 15; i3++) {
                i2 += c6799.f19677.read(bArr, i, length);
                if (i2 > 0) {
                    i += i2;
                    length -= i2;
                }
            }
            if (i != bArr.length) {
                throw new IOException("Cannot read fully into byte buffer");
            }
        }
        return i;
    }

    /* JADX INFO: renamed from: ֏ */
    public abstract T mo9957(C6823 c6823, char[] cArr);

    /* JADX INFO: renamed from: ֏ */
    public void mo9958(InputStream inputStream) {
    }
}
