package p421.p433.p434.p439.p440;

import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;

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

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

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

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

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

    public C6792(AbstractC6790 abstractC6790) {
        super(abstractC6790);
        this.f19664 = new byte[1];
        this.f19662 = new Inflater(true);
        this.f19663 = new byte[4096];
    }

    @Override // p421.p433.p434.p439.p440.AbstractC6791, java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
    public void close() throws IOException {
        Inflater inflater = this.f19662;
        if (inflater != null) {
            inflater.end();
        }
        this.f19660.close();
    }

    @Override // p421.p433.p434.p439.p440.AbstractC6791, java.io.InputStream
    public int read() {
        if (read(this.f19664) == -1) {
            return -1;
        }
        return this.f19664[0];
    }

    @Override // p421.p433.p434.p439.p440.AbstractC6791, java.io.InputStream
    public int read(byte[] bArr) {
        return read(bArr, 0, bArr.length);
    }

    /* JADX WARN: Code restructure failed: missing block: B:16:0x003e, code lost:
    
        return -1;
     */
    @Override // p421.p433.p434.p439.p440.AbstractC6791, java.io.InputStream
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public int read(byte[] bArr, int i, int i2) throws IOException {
        while (true) {
            try {
                int iInflate = this.f19662.inflate(bArr, i, i2);
                if (iInflate != 0) {
                    return iInflate;
                }
                if (this.f19662.finished() || this.f19662.needsDictionary()) {
                    break;
                }
                if (this.f19662.needsInput()) {
                    byte[] bArr2 = this.f19663;
                    int i3 = super.read(bArr2, 0, bArr2.length);
                    this.f19665 = i3;
                    if (i3 == -1) {
                        throw new EOFException("Unexpected end of input stream");
                    }
                    this.f19662.setInput(this.f19663, 0, i3);
                }
            } catch (DataFormatException e) {
                throw new IOException(e);
            }
        }
    }

    @Override // p421.p433.p434.p439.p440.AbstractC6791
    /* JADX INFO: renamed from: ֏ */
    public void mo9961(InputStream inputStream) {
        Inflater inflater = this.f19662;
        if (inflater != null) {
            inflater.end();
            this.f19662 = null;
        }
        this.f19660.mo9958(inputStream);
    }

    @Override // p421.p433.p434.p439.p440.AbstractC6791
    /* JADX INFO: renamed from: ֏ */
    public void mo9962(PushbackInputStream pushbackInputStream) throws IOException {
        int remaining = this.f19662.getRemaining();
        if (remaining > 0) {
            pushbackInputStream.unread(this.f19660.f19657, this.f19665 - remaining, remaining);
        }
    }
}
