package ᨨ;

import android.support.v4.media.session.PlaybackStateCompat;
import java.io.IOException;
import ඓ.K.K.K.C1293;

/* renamed from: ᨨ.K  reason: contains not printable characters */
/* compiled from: AsyncTimeout */
public class C1484 implements AbstractC1473 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final /* synthetic */ C1470 f5513;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final /* synthetic */ AbstractC1473 f5514;

    public C1484(C1470 r1, AbstractC1473 r2) {
        this.f5513 = r1;
        this.f5514 = r2;
    }

    @Override // ᨨ.AbstractC1473, java.io.Closeable, java.lang.AutoCloseable
    public void close() throws IOException {
        this.f5513.m3689();
        try {
            this.f5514.close();
            this.f5513.m3688(true);
        } catch (IOException e) {
            C1470 r1 = this.f5513;
            if (!r1.m3686()) {
                throw e;
            }
            throw r1.m3687(e);
        } catch (Throwable th) {
            this.f5513.m3688(false);
            throw th;
        }
    }

    @Override // ᨨ.AbstractC1473, java.io.Flushable
    public void flush() throws IOException {
        this.f5513.m3689();
        try {
            this.f5514.flush();
            this.f5513.m3688(true);
        } catch (IOException e) {
            C1470 r1 = this.f5513;
            if (!r1.m3686()) {
                throw e;
            }
            throw r1.m3687(e);
        } catch (Throwable th) {
            this.f5513.m3688(false);
            throw th;
        }
    }

    @Override // ᨨ.AbstractC1473
    public C1477 timeout() {
        return this.f5513;
    }

    public String toString() {
        StringBuilder r0 = C1293.m3416("AsyncTimeout.sink(");
        r0.append(this.f5514);
        r0.append(")");
        return r0.toString();
    }

    @Override // ᨨ.AbstractC1473
    /* renamed from: K  reason: contains not printable characters */
    public void m3732(C1492 r7, long j) throws IOException {
        C1491.m3764(r7.f5529, 0, j);
        while (true) {
            long j2 = 0;
            if (j > 0) {
                C1475 r2 = r7.f5530;
                while (true) {
                    if (j2 >= PlaybackStateCompat.ACTION_PREPARE_FROM_SEARCH) {
                        break;
                    }
                    j2 += (long) (r2.f5494 - r2.f5496);
                    if (j2 >= j) {
                        j2 = j;
                        break;
                    }
                    r2 = r2.f5499;
                }
                this.f5513.m3689();
                try {
                    this.f5514.m3692(r7, j2);
                    j -= j2;
                    this.f5513.m3688(true);
                } catch (IOException e) {
                    C1470 r8 = this.f5513;
                    if (!r8.m3686()) {
                        throw e;
                    }
                    throw r8.m3687(e);
                } catch (Throwable th) {
                    this.f5513.m3688(false);
                    throw th;
                }
            } else {
                return;
            }
        }
    }
}
