package q7;

import P6.g;
import java.io.IOException;
import o7.l;
import x7.B;
import x7.C1731g;
import x7.H;
import x7.J;
import x7.p;

/* JADX INFO: loaded from: classes.dex */
public abstract class a implements H {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final p f16329q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public boolean f16330r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ F4.a f16331s;

    public a(F4.a aVar) {
        this.f16331s = aVar;
        this.f16329q = new p(((B) aVar.f2497d).f18724q.f());
    }

    @Override // x7.H
    public long M(C1731g c1731g, long j8) throws IOException {
        F4.a aVar = this.f16331s;
        g.e(c1731g, "sink");
        try {
            return ((B) aVar.f2497d).M(c1731g, j8);
        } catch (IOException e8) {
            ((l) aVar.f2496c).l();
            a();
            throw e8;
        }
    }

    public final void a() {
        F4.a aVar = this.f16331s;
        int i = aVar.f2494a;
        if (i == 6) {
            return;
        }
        if (i != 5) {
            throw new IllegalStateException("state: " + aVar.f2494a);
        }
        p pVar = this.f16329q;
        J j8 = pVar.f18779e;
        pVar.f18779e = J.f18740d;
        j8.a();
        j8.b();
        aVar.f2494a = 6;
    }

    @Override // x7.H
    public final J f() {
        return this.f16329q;
    }
}
