package defpackage;

import java.io.IOException;
import java.net.ProtocolException;

/* JADX INFO: renamed from: ᵪⁱˌᵣ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3941 extends AbstractC2405 {

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public boolean f15061;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public final /* synthetic */ C0764 f15062;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final boolean f15063;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final long f15064;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public long f15065;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public boolean f15066;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public boolean f15067;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C3941(C0764 c0764, InterfaceC3906 interfaceC3906, long j, boolean z) {
        super(interfaceC3906);
        this.f15062 = c0764;
        this.f15064 = j;
        this.f15063 = z;
        this.f15066 = true;
        if (j == 0) {
            m8682(null);
        }
    }

    @Override // defpackage.AbstractC2405, java.io.Closeable, java.lang.AutoCloseable
    public final void close() throws IOException {
        if (this.f15061) {
            return;
        }
        this.f15061 = true;
        try {
            super.close();
            m8682(null);
        } catch (IOException e) {
            throw m8682(e);
        }
    }

    @Override // defpackage.InterfaceC3906
    /* JADX INFO: renamed from: ᵪᵹᵥᵻ */
    public final long mo1490(C4903 c4903, long j) throws IOException {
        if (this.f15061) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("closed");
            return 0L;
        }
        try {
            long jMo1490 = this.f9390.mo1490(c4903, 8192L);
            if (this.f15066) {
                this.f15066 = false;
                ((C4778) this.f15062.f3428).f18181.getClass();
            }
            if (jMo1490 == -1) {
                m8682(null);
                return -1L;
            }
            long j2 = this.f15065 + jMo1490;
            long j3 = this.f15064;
            if (j3 != -1 && j2 > j3) {
                throw new ProtocolException("expected " + this.f15064 + " bytes but received " + j2);
            }
            this.f15065 = j2;
            if (((InterfaceC0340) this.f15062.f3429).mo1603()) {
                m8682(null);
            }
            return jMo1490;
        } catch (IOException e) {
            throw m8682(e);
        }
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final IOException m8682(IOException iOException) {
        if (this.f15067) {
            return iOException;
        }
        this.f15067 = true;
        if (iOException == null && this.f15066) {
            this.f15066 = false;
            ((C4778) this.f15062.f3428).f18181.getClass();
        }
        return C0764.m2737(this.f15062, this.f15063, iOException, 8);
    }
}
