package p461;

import java.io.IOException;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p242.p246.p251.C4303;
import p402.p411.p413.C6635;

/* JADX INFO: renamed from: ޑ.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C7101 implements InterfaceC7127 {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final /* synthetic */ C7098 f20625;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final /* synthetic */ InterfaceC7127 f20626;

    public C7101(C7098 c7098, InterfaceC7127 interfaceC7127) {
        this.f20625 = c7098;
        this.f20626 = interfaceC7127;
    }

    @Override // p461.InterfaceC7127, java.io.Closeable, java.lang.AutoCloseable
    public void close() throws IOException {
        C7098 c7098 = this.f20625;
        c7098.m10399();
        try {
            this.f20626.close();
            if (c7098.m10400()) {
                throw c7098.mo10342((IOException) null);
            }
        } catch (IOException e) {
            if (!c7098.m10400()) {
                throw e;
            }
            throw c7098.mo10342(e);
        } finally {
            c7098.m10400();
        }
    }

    @Override // p461.InterfaceC7127, java.io.Flushable
    public void flush() throws IOException {
        C7098 c7098 = this.f20625;
        c7098.m10399();
        try {
            this.f20626.flush();
            if (c7098.m10400()) {
                throw c7098.mo10342((IOException) null);
            }
        } catch (IOException e) {
            if (!c7098.m10400()) {
                throw e;
            }
            throw c7098.mo10342(e);
        } finally {
            c7098.m10400();
        }
    }

    public String toString() {
        StringBuilder sbM4889 = C2803.m4889("AsyncTimeout.sink(");
        sbM4889.append(this.f20626);
        sbM4889.append(')');
        return sbM4889.toString();
    }

    @Override // p461.InterfaceC7127
    /* JADX INFO: renamed from: ֏ */
    public void mo10205(C7103 c7103, long j) throws IOException {
        if (c7103 == null) {
            C6635.m9824("source");
            throw null;
        }
        C4303.m7086(c7103.f20630, 0L, j);
        while (true) {
            long j2 = 0;
            if (j > 0) {
                C7123 c7123 = c7103.f20629;
                if (c7123 == null) {
                    C6635.m9822();
                    throw null;
                }
                do {
                    if (j2 < 65536) {
                        j2 += (long) (c7123.f20667 - c7123.f20666);
                        if (j2 >= j) {
                            j2 = j;
                        } else {
                            c7123 = c7123.f20670;
                        }
                    }
                    C7098 c7098 = this.f20625;
                    c7098.m10399();
                    try {
                        this.f20626.mo10205(c7103, j2);
                        if (c7098.m10400()) {
                            throw c7098.mo10342((IOException) null);
                        }
                        j -= j2;
                    } catch (IOException e) {
                        if (!c7098.m10400()) {
                            throw e;
                        }
                        throw c7098.mo10342(e);
                    } finally {
                        c7098.m10400();
                    }
                } while (c7123 != null);
                C6635.m9822();
                throw null;
            }
            return;
        }
    }

    @Override // p461.InterfaceC7127
    /* JADX INFO: renamed from: ށ */
    public C7130 mo10278() {
        return this.f20625;
    }
}
