package defpackage;

import java.io.EOFException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ByteChannel;
import java.nio.charset.Charset;

/* renamed from: ˇᵠᵦ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0963 implements InterfaceC4777, InterfaceC3656, Cloneable, ByteChannel {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public long f4314;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public C3514 f4315;

    public final Object clone() {
        C0963 c0963 = new C0963();
        if (this.f4314 == 0) {
            return c0963;
        }
        C3514 c3514 = this.f4315;
        C3514 c3514M8038 = c3514.m8038();
        c0963.f4315 = c3514M8038;
        c3514M8038.f13186 = c3514M8038;
        c3514M8038.f13187 = c3514M8038;
        for (C3514 c35142 = c3514.f13187; c35142 != c3514; c35142 = c35142.f13187) {
            c3514M8038.f13186.m8040(c35142.m8038());
        }
        c0963.f4314 = this.f4314;
        return c0963;
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.Channel, defpackage.InterfaceC3280
    public final void close() {
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof C0963)) {
            return false;
        }
        long j = this.f4314;
        C0963 c0963 = (C0963) obj;
        if (j != c0963.f4314) {
            return false;
        }
        if (j == 0) {
            return true;
        }
        C3514 c3514 = this.f4315;
        C3514 c35142 = c0963.f4315;
        int i = c3514.f13190;
        int i2 = c35142.f13190;
        long j2 = 0;
        while (j2 < this.f4314) {
            long jMin = Math.min(c3514.f13188 - i, c35142.f13188 - i2);
            long j3 = 0;
            while (j3 < jMin) {
                int i3 = i + 1;
                int i4 = i2 + 1;
                if (c3514.f13189[i] != c35142.f13189[i2]) {
                    return false;
                }
                j3++;
                i = i3;
                i2 = i4;
            }
            if (i == c3514.f13188) {
                c3514 = c3514.f13187;
                i = c3514.f13190;
            }
            if (i2 == c35142.f13188) {
                c35142 = c35142.f13187;
                i2 = c35142.f13190;
            }
            j2 += jMin;
        }
        return true;
    }

    @Override // defpackage.InterfaceC3656, defpackage.InterfaceC3280, java.io.Flushable
    public final void flush() {
    }

    public final int hashCode() {
        C3514 c3514 = this.f4315;
        if (c3514 == null) {
            return 0;
        }
        int i = 1;
        do {
            int i2 = c3514.f13188;
            for (int i3 = c3514.f13190; i3 < i2; i3++) {
                i = (i * 31) + c3514.f13189[i3];
            }
            c3514 = c3514.f13187;
        } while (c3514 != this.f4315);
        return i;
    }

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

    @Override // java.nio.channels.ReadableByteChannel
    public final int read(ByteBuffer byteBuffer) {
        C3514 c3514 = this.f4315;
        if (c3514 == null) {
            return -1;
        }
        int iMin = Math.min(byteBuffer.remaining(), c3514.f13188 - c3514.f13190);
        byteBuffer.put(c3514.f13189, c3514.f13190, iMin);
        int i = c3514.f13190 + iMin;
        c3514.f13190 = i;
        this.f4314 -= iMin;
        if (i == c3514.f13188) {
            this.f4315 = c3514.m8039();
            AbstractC3467.m7895(c3514);
        }
        return iMin;
    }

    public final int read(byte[] bArr, int i, int i2) {
        ᵩʛʽ.ᵸˑ(bArr.length, i, i2);
        C3514 c3514 = this.f4315;
        if (c3514 == null) {
            return -1;
        }
        int iMin = Math.min(i2, c3514.f13188 - c3514.f13190);
        byte[] bArr2 = c3514.f13189;
        int i3 = c3514.f13190;
        System.arraycopy(bArr2, i3, bArr, i, (i3 + iMin) - i3);
        int i4 = c3514.f13190 + iMin;
        c3514.f13190 = i4;
        this.f4314 -= iMin;
        if (i4 == c3514.f13188) {
            this.f4315 = c3514.m8039();
            AbstractC3467.m7895(c3514);
        }
        return iMin;
    }

    @Override // defpackage.InterfaceC4777
    public final byte readByte() throws EOFException {
        long j = this.f4314;
        if (j == 0) {
            throw new EOFException();
        }
        C3514 c3514 = this.f4315;
        int i = c3514.f13190;
        int i2 = c3514.f13188;
        int i3 = i + 1;
        byte b = c3514.f13189[i];
        this.f4314 = j - 1;
        if (i3 != i2) {
            c3514.f13190 = i3;
            return b;
        }
        this.f4315 = c3514.m8039();
        AbstractC3467.m7895(c3514);
        return b;
    }

    @Override // defpackage.InterfaceC4777
    public final int readInt() throws EOFException {
        long j = this.f4314;
        if (j < 4) {
            throw new EOFException();
        }
        C3514 c3514 = this.f4315;
        int i = c3514.f13190;
        int i2 = c3514.f13188;
        if (i2 - i < 4) {
            return (readByte() & 255) | ((readByte() & 255) << 24) | ((readByte() & 255) << 16) | ((readByte() & 255) << 8);
        }
        byte[] bArr = c3514.f13189;
        int i3 = i + 3;
        int i4 = ((bArr[i + 1] & 255) << 16) | ((bArr[i] & 255) << 24) | ((bArr[i + 2] & 255) << 8);
        int i5 = i + 4;
        int i6 = (bArr[i3] & 255) | i4;
        this.f4314 = j - 4;
        if (i5 != i2) {
            c3514.f13190 = i5;
            return i6;
        }
        this.f4315 = c3514.m8039();
        AbstractC3467.m7895(c3514);
        return i6;
    }

    @Override // defpackage.InterfaceC4777
    public final short readShort() throws EOFException {
        long j = this.f4314;
        if (j < 2) {
            throw new EOFException();
        }
        C3514 c3514 = this.f4315;
        int i = c3514.f13190;
        int i2 = c3514.f13188;
        if (i2 - i < 2) {
            return (short) ((readByte() & 255) | ((readByte() & 255) << 8));
        }
        byte[] bArr = c3514.f13189;
        int i3 = i + 1;
        int i4 = (bArr[i] & 255) << 8;
        int i5 = i + 2;
        int i6 = (bArr[i3] & 255) | i4;
        this.f4314 = j - 2;
        if (i5 == i2) {
            this.f4315 = c3514.m8039();
            AbstractC3467.m7895(c3514);
        } else {
            c3514.f13190 = i5;
        }
        return (short) i6;
    }

    @Override // defpackage.InterfaceC4777
    public final boolean request(long j) {
        return this.f4314 >= j;
    }

    @Override // defpackage.InterfaceC4777
    public final void skip(long j) throws EOFException {
        while (j > 0) {
            C3514 c3514 = this.f4315;
            if (c3514 == null) {
                throw new EOFException();
            }
            int iMin = (int) Math.min(j, c3514.f13188 - c3514.f13190);
            long j2 = iMin;
            this.f4314 -= j2;
            j -= j2;
            int i = c3514.f13190 + iMin;
            c3514.f13190 = i;
            if (i == c3514.f13188) {
                this.f4315 = c3514.m8039();
                AbstractC3467.m7895(c3514);
            }
        }
    }

    public final String toString() {
        long j = this.f4314;
        if (j <= 2147483647L) {
            return m3293((int) j).toString();
        }
        throw new IllegalStateException(("size > Int.MAX_VALUE: " + this.f4314).toString());
    }

    @Override // java.nio.channels.WritableByteChannel
    public final int write(ByteBuffer byteBuffer) {
        int iRemaining = byteBuffer.remaining();
        int i = iRemaining;
        while (i > 0) {
            C3514 c3514M3279 = m3279(1);
            int iMin = Math.min(i, 8192 - c3514M3279.f13188);
            byteBuffer.get(c3514M3279.f13189, c3514M3279.f13188, iMin);
            i -= iMin;
            c3514M3279.f13188 += iMin;
        }
        this.f4314 += iRemaining;
        return iRemaining;
    }

    @Override // defpackage.InterfaceC3656
    public final InterfaceC3656 write(byte[] bArr) {
        write(bArr, 0, bArr.length);
        return this;
    }

    public final void write(byte[] bArr, int i, int i2) {
        long j = i2;
        ᵩʛʽ.ᵸˑ(bArr.length, i, j);
        int i3 = i2 + i;
        while (i < i3) {
            C3514 c3514M3279 = m3279(1);
            int iMin = Math.min(i3 - i, 8192 - c3514M3279.f13188);
            int i4 = i + iMin;
            System.arraycopy(bArr, i, c3514M3279.f13189, c3514M3279.f13188, i4 - i);
            c3514M3279.f13188 += iMin;
            i = i4;
        }
        this.f4314 += j;
    }

    @Override // defpackage.InterfaceC3656
    public final /* bridge */ /* synthetic */ InterfaceC3656 writeByte(int i) {
        m3278(i);
        return this;
    }

    @Override // defpackage.InterfaceC3656
    public final /* bridge */ /* synthetic */ InterfaceC3656 writeInt(int i) {
        m3283(i);
        return this;
    }

    @Override // defpackage.InterfaceC3656
    public final /* bridge */ /* synthetic */ InterfaceC3656 writeShort(int i) {
        m3253(i);
        return this;
    }

    /* renamed from: ʽᵢˊ, reason: contains not printable characters */
    public final void m3253(int i) {
        C3514 c3514M3279 = m3279(2);
        byte[] bArr = c3514M3279.f13189;
        int i2 = c3514M3279.f13188;
        bArr[i2] = (byte) ((i >>> 8) & 255);
        bArr[i2 + 1] = (byte) (i & 255);
        c3514M3279.f13188 = i2 + 2;
        this.f4314 += 2;
    }

    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public final String m3254() {
        return m3292(this.f4314, AbstractC2356.f9221);
    }

    /* renamed from: ʿᵘˆ, reason: contains not printable characters */
    public final void m3255(String str) {
        m3270(0, str.length(), str);
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public final void mo3256(long j) throws EOFException {
        if (this.f4314 < j) {
            throw new EOFException();
        }
    }

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public final long m3257(C2185 c2185, long j) {
        long j2 = 0;
        if (j < 0) {
            ᵹˉᵞ.ᵸˑ(AbstractC4737.m10015(j, "fromIndex < 0: "));
            return 0L;
        }
        C3514 c3514 = this.f4315;
        if (c3514 == null) {
            return -1L;
        }
        long j3 = this.f4314;
        if (j3 - j < j) {
            while (j3 > j) {
                c3514 = c3514.f13186;
                j3 -= c3514.f13188 - c3514.f13190;
            }
            if (c2185.mo5840() == 2) {
                byte bMo5849 = c2185.mo5849(0);
                byte bMo58492 = c2185.mo5849(1);
                while (j3 < this.f4314) {
                    byte[] bArr = c3514.f13189;
                    int i = c3514.f13188;
                    for (int i2 = (int) ((c3514.f13190 + j) - j3); i2 < i; i2++) {
                        byte b = bArr[i2];
                        if (b == bMo5849 || b == bMo58492) {
                            return (i2 - c3514.f13190) + j3;
                        }
                    }
                    j3 += c3514.f13188 - c3514.f13190;
                    c3514 = c3514.f13187;
                    j = j3;
                }
            } else {
                byte[] bArrMo5839 = c2185.mo5839();
                while (j3 < this.f4314) {
                    byte[] bArr2 = c3514.f13189;
                    int i3 = c3514.f13188;
                    for (int i4 = (int) ((c3514.f13190 + j) - j3); i4 < i3; i4++) {
                        byte b2 = bArr2[i4];
                        for (byte b3 : bArrMo5839) {
                            if (b2 == b3) {
                                return (i4 - c3514.f13190) + j3;
                            }
                        }
                    }
                    j3 += c3514.f13188 - c3514.f13190;
                    c3514 = c3514.f13187;
                    j = j3;
                }
            }
            return -1L;
        }
        while (true) {
            long j4 = (c3514.f13188 - c3514.f13190) + j2;
            if (j4 > j) {
                break;
            }
            c3514 = c3514.f13187;
            j2 = j4;
        }
        if (c2185.mo5840() == 2) {
            byte bMo58493 = c2185.mo5849(0);
            byte bMo58494 = c2185.mo5849(1);
            while (j2 < this.f4314) {
                byte[] bArr3 = c3514.f13189;
                int i5 = c3514.f13188;
                for (int i6 = (int) ((c3514.f13190 + j) - j2); i6 < i5; i6++) {
                    byte b4 = bArr3[i6];
                    if (b4 == bMo58493 || b4 == bMo58494) {
                        return (i6 - c3514.f13190) + j2;
                    }
                }
                j2 += c3514.f13188 - c3514.f13190;
                c3514 = c3514.f13187;
                j = j2;
            }
        } else {
            byte[] bArrMo58392 = c2185.mo5839();
            while (j2 < this.f4314) {
                byte[] bArr4 = c3514.f13189;
                int i7 = c3514.f13188;
                for (int i8 = (int) ((c3514.f13190 + j) - j2); i8 < i7; i8++) {
                    byte b5 = bArr4[i8];
                    for (byte b6 : bArrMo58392) {
                        if (b5 == b6) {
                            return (i8 - c3514.f13190) + j2;
                        }
                    }
                }
                j2 += c3514.f13188 - c3514.f13190;
                c3514 = c3514.f13187;
                j = j2;
            }
        }
        return -1L;
    }

    /* renamed from: ˆᵴᵜˏ, reason: contains not printable characters */
    public final void m3258(C2185 c2185) {
        c2185.mo5847(this, c2185.mo5840());
    }

    /* JADX WARN: Removed duplicated region for block: B:33:0x008d  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x0097  */
    /* JADX WARN: Removed duplicated region for block: B:36:0x009b  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x009f A[EDGE_INSN: B:44:0x009f->B:38:0x009f BREAK  A[LOOP:0: B:5:0x000c->B:46:?], SYNTHETIC] */
    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final long m3259() throws java.io.EOFException {
        /*
            r15 = this;
            long r0 = r15.f4314
            r2 = 0
            int r0 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1))
            if (r0 == 0) goto La6
            r0 = 0
            r1 = r0
            r6 = r1
            r4 = r2
        Lc:
            ᵥᵖˋ r7 = r15.f4315
            byte[] r8 = r7.f13189
            int r9 = r7.f13190
            int r10 = r7.f13188
        L14:
            if (r9 >= r10) goto L8b
            r11 = r8[r9]
            r12 = 48
            if (r11 < r12) goto L23
            r12 = 57
            if (r11 > r12) goto L23
            int r12 = r11 + (-48)
            goto L38
        L23:
            r12 = 97
            if (r11 < r12) goto L2e
            r12 = 102(0x66, float:1.43E-43)
            if (r11 > r12) goto L2e
            int r12 = r11 + (-87)
            goto L38
        L2e:
            r12 = 65
            if (r11 < r12) goto L63
            r12 = 70
            if (r11 > r12) goto L63
            int r12 = r11 + (-55)
        L38:
            r13 = -1152921504606846976(0xf000000000000000, double:-3.105036184601418E231)
            long r13 = r13 & r4
            int r13 = (r13 > r2 ? 1 : (r13 == r2 ? 0 : -1))
            if (r13 != 0) goto L48
            r11 = 4
            long r4 = r4 << r11
            long r11 = (long) r12
            long r4 = r4 | r11
            int r9 = r9 + 1
            int r1 = r1 + 1
            goto L14
        L48:
            ˇᵠᵦ r15 = new ˇᵠᵦ
            r15.<init>()
            r15.m3289(r4)
            r15.m3278(r11)
            java.lang.NumberFormatException r0 = new java.lang.NumberFormatException
            java.lang.String r15 = r15.m3254()
            java.lang.String r1 = "Number too large: "
            java.lang.String r15 = r1.concat(r15)
            r0.<init>(r15)
            throw r0
        L63:
            r6 = 1
            if (r1 == 0) goto L67
            goto L8b
        L67:
            java.lang.NumberFormatException r15 = new java.lang.NumberFormatException
            char[] r1 = ᵕˏᵛ.ᵴᵳ
            int r2 = r11 >> 4
            r2 = r2 & 15
            char r2 = r1[r2]
            r3 = r11 & 15
            char r1 = r1[r3]
            r3 = 2
            char[] r3 = new char[r3]
            r3[r0] = r2
            r3[r6] = r1
            java.lang.String r0 = new java.lang.String
            r0.<init>(r3)
            java.lang.String r1 = "Expected leading [0-9a-fA-F] character but was 0x"
            java.lang.String r0 = r1.concat(r0)
            r15.<init>(r0)
            throw r15
        L8b:
            if (r9 != r10) goto L97
            ᵥᵖˋ r8 = r7.m8039()
            r15.f4315 = r8
            defpackage.AbstractC3467.m7895(r7)
            goto L99
        L97:
            r7.f13190 = r9
        L99:
            if (r6 != 0) goto L9f
            ᵥᵖˋ r7 = r15.f4315
            if (r7 != 0) goto Lc
        L9f:
            long r2 = r15.f4314
            long r0 = (long) r1
            long r2 = r2 - r0
            r15.f4314 = r2
            return r4
        La6:
            java.io.EOFException r15 = new java.io.EOFException
            r15.<init>()
            throw r15
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C0963.m3259():long");
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ˊʾˊ, reason: contains not printable characters */
    public final OutputStream mo3260() {
        return new C0040(this, 0);
    }

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public final long m3261(byte b, long j, long j2) {
        C3514 c3514;
        long j3 = 0;
        if (0 > j || j > j2) {
            StringBuilder sb = new StringBuilder("size=");
            sb.append(this.f4314);
            AbstractC1327.m4101(sb, " fromIndex=", j, " toIndex=");
            sb.append(j2);
            throw new IllegalArgumentException(sb.toString().toString());
        }
        long j4 = this.f4314;
        if (j2 > j4) {
            j2 = j4;
        }
        if (j == j2 || (c3514 = this.f4315) == null) {
            return -1L;
        }
        if (j4 - j < j) {
            while (j4 > j) {
                c3514 = c3514.f13186;
                j4 -= c3514.f13188 - c3514.f13190;
            }
            while (j4 < j2) {
                byte[] bArr = c3514.f13189;
                int iMin = (int) Math.min(c3514.f13188, (c3514.f13190 + j2) - j4);
                for (int i = (int) ((c3514.f13190 + j) - j4); i < iMin; i++) {
                    if (bArr[i] == b) {
                        return (i - c3514.f13190) + j4;
                    }
                }
                j4 += c3514.f13188 - c3514.f13190;
                c3514 = c3514.f13187;
                j = j4;
            }
            return -1L;
        }
        while (true) {
            long j5 = (c3514.f13188 - c3514.f13190) + j3;
            if (j5 > j) {
                break;
            }
            c3514 = c3514.f13187;
            j3 = j5;
        }
        while (j3 < j2) {
            byte[] bArr2 = c3514.f13189;
            int iMin2 = (int) Math.min(c3514.f13188, (c3514.f13190 + j2) - j3);
            for (int i2 = (int) ((c3514.f13190 + j) - j3); i2 < iMin2; i2++) {
                if (bArr2[i2] == b) {
                    return (i2 - c3514.f13190) + j3;
                }
            }
            j3 += c3514.f13188 - c3514.f13190;
            c3514 = c3514.f13187;
            j = j3;
        }
        return -1L;
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public final long mo3262(C2185 c2185) {
        byte[] bArr = AbstractC4683.f17319;
        return AbstractC4683.m9869(this, c2185, 0L, Long.MAX_VALUE, c2185.mo5840());
    }

    @Override // defpackage.InterfaceC4777, defpackage.InterfaceC3656
    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final C0963 mo3263() {
        return this;
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final /* bridge */ /* synthetic */ InterfaceC3656 mo3264(int i, byte[] bArr) {
        write(bArr, 0, i);
        return this;
    }

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public final short m3265() throws EOFException {
        short s = readShort();
        return (short) (((s & 255) << 8) | ((65280 & s) >>> 8));
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public final boolean mo3266(C2185 c2185) {
        return m3269(0L, c2185, c2185.mo5840());
    }

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public final byte m3267(long j) {
        ᵩʛʽ.ᵸˑ(this.f4314, j, 1L);
        C3514 c3514 = this.f4315;
        c3514.getClass();
        long j2 = this.f4314;
        if (j2 - j < j) {
            while (j2 > j) {
                c3514 = c3514.f13186;
                j2 -= c3514.f13188 - c3514.f13190;
            }
            return c3514.f13189[(int) ((c3514.f13190 + j) - j2)];
        }
        long j3 = 0;
        while (true) {
            int i = c3514.f13188;
            int i2 = c3514.f13190;
            long j4 = (i - i2) + j3;
            if (j4 > j) {
                return c3514.f13189[(int) ((i2 + j) - j3)];
            }
            c3514 = c3514.f13187;
            j3 = j4;
        }
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public final int mo3268(C2679 c2679) throws EOFException {
        int iM9871 = AbstractC4683.m9871(this, c2679, false);
        if (iM9871 == -1) {
            return -1;
        }
        skip(c2679.f10405[iM9871].mo5840());
        return iM9871;
    }

    @Override // defpackage.InterfaceC3280
    /* renamed from: ᐧﾞ */
    public final void mo2377(C0963 c0963, long j) {
        C3514 c3514M7896;
        if (c0963 == this) {
            ᵹˉᵞ.ˌᵜᵹᵩ("source == this");
            return;
        }
        ᵩʛʽ.ᵸˑ(c0963.f4314, 0L, j);
        while (j > 0) {
            C3514 c3514 = c0963.f4315;
            int i = c3514.f13188 - c3514.f13190;
            if (j < i) {
                C3514 c35142 = this.f4315;
                C3514 c35143 = c35142 != null ? c35142.f13186 : null;
                if (c35143 != null && c35143.f13185) {
                    if ((c35143.f13188 + j) - (c35143.f13191 ? 0 : c35143.f13190) <= 8192) {
                        c3514.m8041(c35143, (int) j);
                        c0963.f4314 -= j;
                        this.f4314 += j;
                        return;
                    }
                }
                int i2 = (int) j;
                if (i2 <= 0 || i2 > i) {
                    ᵹˉᵞ.ˌᵜᵹᵩ("byteCount out of range");
                    return;
                }
                if (i2 >= 1024) {
                    c3514M7896 = c3514.m8038();
                } else {
                    c3514M7896 = AbstractC3467.m7896();
                    byte[] bArr = c3514.f13189;
                    byte[] bArr2 = c3514M7896.f13189;
                    int i3 = c3514.f13190;
                    AbstractC1658.m4721(i3, i3 + i2, bArr, bArr2);
                }
                c3514M7896.f13188 = c3514M7896.f13190 + i2;
                c3514.f13190 += i2;
                c3514.f13186.m8040(c3514M7896);
                c0963.f4315 = c3514M7896;
            }
            C3514 c35144 = c0963.f4315;
            long j2 = c35144.f13188 - c35144.f13190;
            c0963.f4315 = c35144.m8039();
            C3514 c35145 = this.f4315;
            if (c35145 == null) {
                this.f4315 = c35144;
                c35144.f13186 = c35144;
                c35144.f13187 = c35144;
            } else {
                c35145.f13186.m8040(c35144);
                C3514 c35146 = c35144.f13186;
                if (c35146 == c35144) {
                    ᵹˉᵞ.ᵳٴᵶ("cannot compact");
                    return;
                } else if (c35146.f13185) {
                    int i4 = c35144.f13188 - c35144.f13190;
                    if (i4 <= (8192 - c35146.f13188) + (c35146.f13191 ? 0 : c35146.f13190)) {
                        c35144.m8041(c35146, i4);
                        c35144.m8039();
                        AbstractC3467.m7895(c35144);
                    }
                }
            }
            c0963.f4314 -= j2;
            this.f4314 += j2;
            j -= j2;
        }
    }

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public final boolean m3269(long j, C2185 c2185, int i) {
        if (i >= 0 && j >= 0 && i + j <= this.f4314 && i <= c2185.mo5840()) {
            return i == 0 || AbstractC4683.m9869(this, c2185, j, j + 1, i) != -1;
        }
        return false;
    }

    @Override // defpackage.InterfaceC3226
    /* renamed from: ᵝᵵᵺ */
    public final C3948 mo2227() {
        return C3948.f14904;
    }

    /* renamed from: ᵠᵪˀᵻ, reason: contains not printable characters */
    public final void m3270(int i, int i2, String str) {
        char cCharAt;
        if (i < 0) {
            ᵹˉᵞ.ᵸˑ(AbstractC2990.m7313(i, "beginIndex < 0: "));
            return;
        }
        if (i2 < i) {
            ᵹˉᵞ.ᵸˑ(AbstractC1327.m4091(i2, i, "endIndex < beginIndex: ", " < "));
            return;
        }
        if (i2 > str.length()) {
            ᵹˉᵞ.ˎˏʜʾ(str.length(), AbstractC1327.m4097(i2, "endIndex > string.length: ", " > "));
            return;
        }
        while (i < i2) {
            char cCharAt2 = str.charAt(i);
            if (cCharAt2 < 128) {
                C3514 c3514M3279 = m3279(1);
                byte[] bArr = c3514M3279.f13189;
                int i3 = c3514M3279.f13188 - i;
                int iMin = Math.min(i2, 8192 - i3);
                int i4 = i + 1;
                bArr[i + i3] = (byte) cCharAt2;
                while (true) {
                    i = i4;
                    if (i >= iMin || (cCharAt = str.charAt(i)) >= 128) {
                        break;
                    }
                    i4 = i + 1;
                    bArr[i + i3] = (byte) cCharAt;
                }
                int i5 = c3514M3279.f13188;
                int i6 = (i3 + i) - i5;
                c3514M3279.f13188 = i5 + i6;
                this.f4314 += i6;
            } else {
                if (cCharAt2 < 2048) {
                    C3514 c3514M32792 = m3279(2);
                    byte[] bArr2 = c3514M32792.f13189;
                    int i7 = c3514M32792.f13188;
                    bArr2[i7] = (byte) ((cCharAt2 >> 6) | 192);
                    bArr2[i7 + 1] = (byte) ((cCharAt2 & '?') | 128);
                    c3514M32792.f13188 = i7 + 2;
                    this.f4314 += 2;
                } else if (cCharAt2 < 55296 || cCharAt2 > 57343) {
                    C3514 c3514M32793 = m3279(3);
                    byte[] bArr3 = c3514M32793.f13189;
                    int i8 = c3514M32793.f13188;
                    bArr3[i8] = (byte) ((cCharAt2 >> '\f') | 224);
                    bArr3[i8 + 1] = (byte) ((63 & (cCharAt2 >> 6)) | 128);
                    bArr3[i8 + 2] = (byte) ((cCharAt2 & '?') | 128);
                    c3514M32793.f13188 = i8 + 3;
                    this.f4314 += 3;
                } else {
                    int i9 = i + 1;
                    char cCharAt3 = i9 < i2 ? str.charAt(i9) : (char) 0;
                    if (cCharAt2 > 56319 || 56320 > cCharAt3 || cCharAt3 >= 57344) {
                        m3278(63);
                        i = i9;
                    } else {
                        int i10 = (((cCharAt2 & 1023) << 10) | (cCharAt3 & 1023)) + 65536;
                        C3514 c3514M32794 = m3279(4);
                        byte[] bArr4 = c3514M32794.f13189;
                        int i11 = c3514M32794.f13188;
                        bArr4[i11] = (byte) ((i10 >> 18) | 240);
                        bArr4[i11 + 1] = (byte) (((i10 >> 12) & 63) | 128);
                        bArr4[i11 + 2] = (byte) (((i10 >> 6) & 63) | 128);
                        bArr4[i11 + 3] = (byte) ((i10 & 63) | 128);
                        c3514M32794.f13188 = i11 + 4;
                        this.f4314 += 4;
                        i += 2;
                    }
                }
                i++;
            }
        }
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵠᵿː, reason: contains not printable characters */
    public final InputStream mo3271() {
        return new C4402(1, this);
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final C2185 mo3272(long j) throws EOFException {
        if (j < 0 || j > 2147483647L) {
            ᵹˉᵞ.ᵸˑ(AbstractC4737.m10015(j, "byteCount: "));
            return null;
        }
        if (this.f4314 < j) {
            throw new EOFException();
        }
        if (j < 4096) {
            return new C2185(m3290(j));
        }
        C2185 c2185M3293 = m3293((int) j);
        skip(j);
        return c2185M3293;
    }

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final void m3273(C0963 c0963, long j, long j2) {
        long j3 = j;
        ᵩʛʽ.ᵸˑ(this.f4314, j3, j2);
        if (j2 == 0) {
            return;
        }
        c0963.f4314 += j2;
        C3514 c3514 = this.f4315;
        while (true) {
            long j4 = c3514.f13188 - c3514.f13190;
            if (j3 < j4) {
                break;
            }
            j3 -= j4;
            c3514 = c3514.f13187;
        }
        long j5 = j2;
        while (j5 > 0) {
            C3514 c3514M8038 = c3514.m8038();
            int i = c3514M8038.f13190 + ((int) j3);
            c3514M8038.f13190 = i;
            c3514M8038.f13188 = Math.min(i + ((int) j5), c3514M8038.f13188);
            C3514 c35142 = c0963.f4315;
            if (c35142 == null) {
                c3514M8038.f13186 = c3514M8038;
                c3514M8038.f13187 = c3514M8038;
                c0963.f4315 = c3514M8038;
            } else {
                c35142.f13186.m8040(c3514M8038);
            }
            j5 -= c3514M8038.f13188 - c3514M8038.f13190;
            c3514 = c3514.f13187;
            j3 = 0;
        }
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public final /* bridge */ /* synthetic */ InterfaceC3656 mo3274(int i, int i2, String str) {
        m3270(i, i2, str);
        return this;
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵡᵶᵡ, reason: contains not printable characters */
    public final long mo3275(C0963 c0963) {
        long j = this.f4314;
        if (j > 0) {
            c0963.mo2377(this, j);
        }
        return j;
    }

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final long m3276() {
        long j = this.f4314;
        if (j == 0) {
            return 0L;
        }
        C3514 c3514 = this.f4315.f13186;
        return (c3514.f13188 >= 8192 || !c3514.f13185) ? j : j - (r2 - c3514.f13190);
    }

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final void m3277() throws EOFException {
        skip(this.f4314);
    }

    /* renamed from: ᵣᵟᵔ, reason: contains not printable characters */
    public final void m3278(int i) {
        C3514 c3514M3279 = m3279(1);
        byte[] bArr = c3514M3279.f13189;
        int i2 = c3514M3279.f13188;
        c3514M3279.f13188 = i2 + 1;
        bArr[i2] = (byte) i;
        this.f4314++;
    }

    /* renamed from: ᵤᵼˑʠ, reason: contains not printable characters */
    public final C3514 m3279(int i) {
        if (i < 1 || i > 8192) {
            ᵹˉᵞ.ˌᵜᵹᵩ("unexpected capacity");
            return null;
        }
        C3514 c3514 = this.f4315;
        if (c3514 == null) {
            C3514 c3514M7896 = AbstractC3467.m7896();
            this.f4315 = c3514M7896;
            c3514M7896.f13186 = c3514M7896;
            c3514M7896.f13187 = c3514M7896;
            return c3514M7896;
        }
        C3514 c35142 = c3514.f13186;
        if (c35142.f13188 + i <= 8192 && c35142.f13185) {
            return c35142;
        }
        C3514 c3514M78962 = AbstractC3467.m7896();
        c35142.m8040(c3514M78962);
        return c3514M78962;
    }

    /* renamed from: ᵥʩᵩˑ, reason: contains not printable characters */
    public final void m3280(long j) {
        boolean z;
        if (j == 0) {
            m3278(48);
            return;
        }
        if (j < 0) {
            j = -j;
            if (j < 0) {
                m3255("-9223372036854775808");
                return;
            }
            z = true;
        } else {
            z = false;
        }
        byte[] bArr = AbstractC4683.f17319;
        int iNumberOfLeadingZeros = ((64 - Long.numberOfLeadingZeros(j)) * 10) >>> 5;
        int i = iNumberOfLeadingZeros + (j > AbstractC4683.f17320[iNumberOfLeadingZeros] ? 1 : 0);
        if (z) {
            i++;
        }
        C3514 c3514M3279 = m3279(i);
        byte[] bArr2 = c3514M3279.f13189;
        int i2 = c3514M3279.f13188 + i;
        while (j != 0) {
            i2--;
            bArr2[i2] = AbstractC4683.f17319[(int) (j % 10)];
            j /= 10;
        }
        if (z) {
            bArr2[i2 - 1] = 45;
        }
        c3514M3279.f13188 += i;
        this.f4314 += i;
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final long mo3281(C2185 c2185) {
        return m3257(c2185, 0L);
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final String mo3282() {
        long jM3261 = m3261((byte) 10, 0L, Long.MAX_VALUE);
        if (jM3261 != -1) {
            return AbstractC4683.m9868(this, jM3261);
        }
        long j = this.f4314;
        if (j != 0) {
            return m3292(j, AbstractC2356.f9221);
        }
        return null;
    }

    /* renamed from: ᵨٴ, reason: contains not printable characters */
    public final void m3283(int i) {
        C3514 c3514M3279 = m3279(4);
        byte[] bArr = c3514M3279.f13189;
        int i2 = c3514M3279.f13188;
        bArr[i2] = (byte) ((i >>> 24) & 255);
        bArr[i2 + 1] = (byte) ((i >>> 16) & 255);
        bArr[i2 + 2] = (byte) ((i >>> 8) & 255);
        bArr[i2 + 3] = (byte) (i & 255);
        c3514M3279.f13188 = i2 + 4;
        this.f4314 += 4;
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public final boolean mo3284() {
        return this.f4314 == 0;
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final String mo3285(long j) {
        return m3292(j, AbstractC2356.f9221);
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public final /* bridge */ /* synthetic */ InterfaceC3656 mo3286(C2185 c2185) {
        m3258(c2185);
        return this;
    }

    @Override // defpackage.InterfaceC3656
    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public final /* bridge */ /* synthetic */ InterfaceC3656 mo3287(String str) {
        m3255(str);
        return this;
    }

    /* renamed from: ᵰʖʢ, reason: contains not printable characters */
    public final void m3288(int i) {
        if (i < 128) {
            m3278(i);
            return;
        }
        if (i < 2048) {
            C3514 c3514M3279 = m3279(2);
            byte[] bArr = c3514M3279.f13189;
            int i2 = c3514M3279.f13188;
            bArr[i2] = (byte) ((i >> 6) | 192);
            bArr[i2 + 1] = (byte) ((i & 63) | 128);
            c3514M3279.f13188 = i2 + 2;
            this.f4314 += 2;
            return;
        }
        if (55296 <= i && i < 57344) {
            m3278(63);
            return;
        }
        if (i < 65536) {
            C3514 c3514M32792 = m3279(3);
            byte[] bArr2 = c3514M32792.f13189;
            int i3 = c3514M32792.f13188;
            bArr2[i3] = (byte) ((i >> 12) | 224);
            bArr2[i3 + 1] = (byte) (((i >> 6) & 63) | 128);
            bArr2[i3 + 2] = (byte) ((i & 63) | 128);
            c3514M32792.f13188 = i3 + 3;
            this.f4314 += 3;
            return;
        }
        if (i > 1114111) {
            ᵹˉᵞ.ˌᵜᵹᵩ("Unexpected code point: 0x".concat(ᵩʛʽ.ˑᵥˁ(i)));
            return;
        }
        C3514 c3514M32793 = m3279(4);
        byte[] bArr3 = c3514M32793.f13189;
        int i4 = c3514M32793.f13188;
        bArr3[i4] = (byte) ((i >> 18) | 240);
        bArr3[i4 + 1] = (byte) (((i >> 12) & 63) | 128);
        bArr3[i4 + 2] = (byte) (((i >> 6) & 63) | 128);
        bArr3[i4 + 3] = (byte) ((i & 63) | 128);
        c3514M32793.f13188 = i4 + 4;
        this.f4314 += 4;
    }

    /* renamed from: ᵲᵟ, reason: contains not printable characters */
    public final void m3289(long j) {
        if (j == 0) {
            m3278(48);
            return;
        }
        long j2 = (j >>> 1) | j;
        long j3 = j2 | (j2 >>> 2);
        long j4 = j3 | (j3 >>> 4);
        long j5 = j4 | (j4 >>> 8);
        long j6 = j5 | (j5 >>> 16);
        long j7 = j6 | (j6 >>> 32);
        long j8 = j7 - ((j7 >>> 1) & 6148914691236517205L);
        long j9 = ((j8 >>> 2) & 3689348814741910323L) + (j8 & 3689348814741910323L);
        long j10 = ((j9 >>> 4) + j9) & 1085102592571150095L;
        long j11 = j10 + (j10 >>> 8);
        long j12 = j11 + (j11 >>> 16);
        int i = (int) ((((j12 & 63) + ((j12 >>> 32) & 63)) + 3) / 4);
        C3514 c3514M3279 = m3279(i);
        byte[] bArr = c3514M3279.f13189;
        int i2 = c3514M3279.f13188;
        for (int i3 = (i2 + i) - 1; i3 >= i2; i3--) {
            bArr[i3] = AbstractC4683.f17319[(int) (15 & j)];
            j >>>= 4;
        }
        c3514M3279.f13188 += i;
        this.f4314 += i;
    }

    @Override // defpackage.InterfaceC3226
    /* renamed from: ᵳٴᵶ */
    public final long mo2229(C0963 c0963, long j) {
        if (j < 0) {
            ᵹˉᵞ.ᵸˑ(AbstractC4737.m10015(j, "byteCount < 0: "));
            return 0L;
        }
        long j2 = this.f4314;
        if (j2 == 0) {
            return -1L;
        }
        if (j > j2) {
            j = j2;
        }
        c0963.mo2377(this, j);
        return j;
    }

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public final byte[] m3290(long j) throws EOFException {
        if (j < 0 || j > 2147483647L) {
            ᵹˉᵞ.ᵸˑ(AbstractC4737.m10015(j, "byteCount: "));
            return null;
        }
        if (this.f4314 < j) {
            throw new EOFException();
        }
        int i = (int) j;
        byte[] bArr = new byte[i];
        int i2 = 0;
        while (i2 < i) {
            int i3 = read(bArr, i2, i - i2);
            if (i3 == -1) {
                throw new EOFException();
            }
            i2 += i3;
        }
        return bArr;
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final String mo3291(Charset charset) {
        return m3292(this.f4314, charset);
    }

    /* renamed from: ᵷᵱ, reason: contains not printable characters */
    public final String m3292(long j, Charset charset) throws EOFException {
        if (j < 0 || j > 2147483647L) {
            ᵹˉᵞ.ᵸˑ(AbstractC4737.m10015(j, "byteCount: "));
            return null;
        }
        if (this.f4314 < j) {
            throw new EOFException();
        }
        if (j == 0) {
            return "";
        }
        C3514 c3514 = this.f4315;
        int i = c3514.f13190;
        if (i + j > c3514.f13188) {
            return new String(m3290(j), charset);
        }
        int i2 = (int) j;
        String str = new String(c3514.f13189, i, i2, charset);
        int i3 = c3514.f13190 + i2;
        c3514.f13190 = i3;
        this.f4314 -= j;
        if (i3 == c3514.f13188) {
            this.f4315 = c3514.m8039();
            AbstractC3467.m7895(c3514);
        }
        return str;
    }

    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public final C2185 m3293(int i) {
        if (i == 0) {
            return C2185.f8597;
        }
        ᵩʛʽ.ᵸˑ(this.f4314, 0L, i);
        C3514 c3514 = this.f4315;
        int i2 = 0;
        int i3 = 0;
        int i4 = 0;
        while (i3 < i) {
            int i5 = c3514.f13188;
            int i6 = c3514.f13190;
            if (i5 == i6) {
                throw new AssertionError("s.limit == s.pos");
            }
            i3 += i5 - i6;
            i4++;
            c3514 = c3514.f13187;
        }
        byte[][] bArr = new byte[i4][];
        int[] iArr = new int[i4 * 2];
        C3514 c35142 = this.f4315;
        int i7 = 0;
        while (i2 < i) {
            bArr[i7] = c35142.f13189;
            i2 += c35142.f13188 - c35142.f13190;
            iArr[i7] = Math.min(i2, i);
            iArr[i7 + i4] = c35142.f13190;
            c35142.f13191 = true;
            i7++;
            c35142 = c35142.f13187;
        }
        return new C4682(bArr, iArr);
    }

    @Override // defpackage.InterfaceC4777
    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final String mo3294(long j) throws EOFException {
        if (j < 0) {
            ᵹˉᵞ.ᵸˑ(AbstractC4737.m10015(j, "limit < 0: "));
            return null;
        }
        long j2 = j != Long.MAX_VALUE ? j + 1 : Long.MAX_VALUE;
        long jM3261 = m3261((byte) 10, 0L, j2);
        if (jM3261 != -1) {
            return AbstractC4683.m9868(this, jM3261);
        }
        if (j2 < this.f4314 && m3267(j2 - 1) == 13 && m3267(j2) == 10) {
            return AbstractC4683.m9868(this, j2);
        }
        C0963 c0963 = new C0963();
        m3273(c0963, 0L, Math.min(32L, this.f4314));
        throw new EOFException("\\n not found: limit=" + Math.min(this.f4314, j) + " content=" + c0963.mo3272(c0963.f4314).mo5850() + (char) 8230);
    }

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