package defpackage;

import java.io.OutputStream;
import java.nio.ByteBuffer;

/* renamed from: ᵙʿⁱ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2567 implements InterfaceC3656 {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final C0963 f9974 = new C0963();

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final InterfaceC3280 f9975;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public boolean f9976;

    public C2567(InterfaceC3280 interfaceC3280) {
        this.f9975 = interfaceC3280;
    }

    @Override // defpackage.InterfaceC3280, java.io.Closeable, java.lang.AutoCloseable
    public final void close() {
        InterfaceC3280 interfaceC3280 = this.f9975;
        if (this.f9976) {
            return;
        }
        try {
            C0963 c0963 = this.f9974;
            long j = c0963.f4314;
            if (j > 0) {
                interfaceC3280.mo2377(c0963, j);
            }
            th = null;
        } catch (Throwable th) {
            th = th;
        }
        try {
            interfaceC3280.close();
        } catch (Throwable th2) {
            if (th == null) {
                th = th2;
            }
        }
        this.f9976 = true;
        if (th != null) {
            throw th;
        }
    }

    @Override // defpackage.InterfaceC3656, defpackage.InterfaceC3280, java.io.Flushable
    public final void flush() {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return;
        }
        C0963 c0963 = this.f9974;
        long j = c0963.f4314;
        InterfaceC3280 interfaceC3280 = this.f9975;
        if (j > 0) {
            interfaceC3280.mo2377(c0963, j);
        }
        interfaceC3280.flush();
    }

    @Override // java.nio.channels.Channel
    public final boolean isOpen() {
        return !this.f9976;
    }

    public final String toString() {
        return "buffer(" + this.f9975 + ')';
    }

    @Override // java.nio.channels.WritableByteChannel
    public final int write(ByteBuffer byteBuffer) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return 0;
        }
        int iWrite = this.f9974.write(byteBuffer);
        m6460();
        return iWrite;
    }

    @Override // defpackage.InterfaceC3656
    public final InterfaceC3656 write(byte[] bArr) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.write(bArr, 0, bArr.length);
        m6460();
        return this;
    }

    @Override // defpackage.InterfaceC3656
    public final InterfaceC3656 writeByte(int i) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.m3278(i);
        m6460();
        return this;
    }

    @Override // defpackage.InterfaceC3656
    public final InterfaceC3656 writeInt(int i) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.m3283(i);
        m6460();
        return this;
    }

    @Override // defpackage.InterfaceC3656
    public final InterfaceC3656 writeShort(int i) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.m3253(i);
        m6460();
        return this;
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ˊʾˊ */
    public final OutputStream mo3260() {
        return new C0040(this, 1);
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ˎˏʜʾ */
    public final C0963 mo3263() {
        return this.f9974;
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ˎˑː */
    public final InterfaceC3656 mo3264(int i, byte[] bArr) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.write(bArr, 0, i);
        m6460();
        return this;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final long m6459(InterfaceC3226 interfaceC3226) {
        long j = 0;
        while (true) {
            long jMo2229 = interfaceC3226.mo2229(this.f9974, 8192L);
            if (jMo2229 == -1) {
                return j;
            }
            j += jMo2229;
            m6460();
        }
    }

    @Override // defpackage.InterfaceC3280
    /* renamed from: ᐧﾞ */
    public final void mo2377(C0963 c0963, long j) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
        } else {
            this.f9974.mo2377(c0963, j);
            m6460();
        }
    }

    @Override // defpackage.InterfaceC3280
    /* renamed from: ᵝᵵᵺ */
    public final C3948 mo2378() {
        return this.f9975.mo2378();
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ᵡᵘˎʽ */
    public final InterfaceC3656 mo3274(int i, int i2, String str) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.m3270(i, i2, str);
        m6460();
        return this;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final InterfaceC3656 m6460() {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        C0963 c0963 = this.f9974;
        long jM3276 = c0963.m3276();
        if (jM3276 > 0) {
            this.f9975.mo2377(c0963, jM3276);
        }
        return this;
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ᵫᵮʾ */
    public final InterfaceC3656 mo3286(C2185 c2185) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.m3258(c2185);
        m6460();
        return this;
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ᵮᵠـˌ */
    public final InterfaceC3656 mo3287(String str) {
        if (this.f9976) {
            ᵹˉᵞ.ᵳٴᵶ("closed");
            return null;
        }
        this.f9974.m3255(str);
        m6460();
        return this;
    }
}
