package p138.p176.p177.p190.p239;

import java.nio.charset.Charset;
import p000.p001.p002.p003.p004.C0567;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ဢ.ސ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4140 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public byte[] f13227;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int f13228;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int f13229;

    public C4140() {
        this.f13227 = C4150.f13264;
    }

    public C4140(int i) {
        this.f13227 = new byte[i];
        this.f13229 = i;
    }

    public C4140(byte[] bArr) {
        this.f13227 = bArr;
        this.f13229 = bArr.length;
    }

    public C4140(byte[] bArr, int i) {
        this.f13227 = bArr;
        this.f13229 = i;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public int m6679() {
        return this.f13229 - this.f13228;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public String m6680(int i) {
        if (i == 0) {
            return "";
        }
        int i2 = (this.f13228 + i) - 1;
        String strM6761 = C4150.m6761(this.f13227, this.f13228, (i2 >= this.f13229 || this.f13227[i2] != 0) ? i : i - 1);
        this.f13228 += i;
        return strM6761;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public String m6681(int i, Charset charset) {
        String str = new String(this.f13227, this.f13228, i, charset);
        this.f13228 += i;
        return str;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m6682(C4139 c4139, int i) {
        m6685(c4139.f13223, 0, i);
        c4139.m6672(0);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m6683(byte[] bArr) {
        int length = bArr.length;
        this.f13227 = bArr;
        this.f13229 = length;
        this.f13228 = 0;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m6684(byte[] bArr, int i) {
        this.f13227 = bArr;
        this.f13229 = i;
        this.f13228 = 0;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m6685(byte[] bArr, int i, int i2) {
        System.arraycopy(this.f13227, this.f13228, bArr, i, i2);
        this.f13228 += i2;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int m6686() {
        return this.f13227[this.f13228] & 255;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public String m6687(int i) {
        return m6681(i, Charset.forName("UTF-8"));
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int m6688() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        int i3 = (bArr[i] & 255) << 24;
        int i4 = i2 + 1;
        this.f13228 = i4;
        int i5 = i3 | ((bArr[i2] & 255) << 16);
        int i6 = i4 + 1;
        this.f13228 = i6;
        int i7 = i5 | ((bArr[i4] & 255) << 8);
        this.f13228 = i6 + 1;
        return (bArr[i6] & 255) | i7;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public void m6689(int i) {
        byte[] bArr = this.f13227;
        if (bArr.length < i) {
            bArr = new byte[i];
        }
        m6684(bArr, i);
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public String m6690() {
        if (m6679() == 0) {
            return null;
        }
        int i = this.f13228;
        while (i < this.f13229 && !C4150.m6806(this.f13227[i])) {
            i++;
        }
        int i2 = this.f13228;
        if (i - i2 >= 3) {
            byte[] bArr = this.f13227;
            if (bArr[i2] == -17 && bArr[i2 + 1] == -69 && bArr[i2 + 2] == -65) {
                this.f13228 = i2 + 3;
            }
        }
        byte[] bArr2 = this.f13227;
        int i3 = this.f13228;
        String strM6761 = C4150.m6761(bArr2, i3, i - i3);
        this.f13228 = i;
        int i4 = this.f13229;
        if (i == i4) {
            return strM6761;
        }
        if (this.f13227[i] == 13) {
            int i5 = i + 1;
            this.f13228 = i5;
            if (i5 == i4) {
                return strM6761;
            }
        }
        byte[] bArr3 = this.f13227;
        int i6 = this.f13228;
        if (bArr3[i6] == 10) {
            this.f13228 = i6 + 1;
        }
        return strM6761;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public void m6691(int i) {
        C0567.m1896(i >= 0 && i <= this.f13227.length);
        this.f13229 = i;
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public int m6692() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        int i3 = bArr[i] & 255;
        int i4 = i2 + 1;
        this.f13228 = i4;
        int i5 = i3 | ((bArr[i2] & 255) << 8);
        int i6 = i4 + 1;
        this.f13228 = i6;
        int i7 = i5 | ((bArr[i4] & 255) << 16);
        this.f13228 = i6 + 1;
        return ((bArr[i6] & 255) << 24) | i7;
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public void m6693(int i) {
        C0567.m1896(i >= 0 && i <= this.f13229);
        this.f13228 = i;
    }

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public short m6694() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        int i3 = bArr[i] & 255;
        this.f13228 = i2 + 1;
        return (short) (((bArr[i2] & 255) << 8) | i3);
    }

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public void m6695(int i) {
        m6693(this.f13228 + i);
    }

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public long m6696() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        long j = ((long) bArr[i]) & 255;
        int i3 = i2 + 1;
        this.f13228 = i3;
        long j2 = j | ((((long) bArr[i2]) & 255) << 8);
        int i4 = i3 + 1;
        this.f13228 = i4;
        long j3 = j2 | ((((long) bArr[i3]) & 255) << 16);
        this.f13228 = i4 + 1;
        return j3 | ((((long) bArr[i4]) & 255) << 24);
    }

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public int m6697() {
        int iM6692 = m6692();
        if (iM6692 >= 0) {
            return iM6692;
        }
        throw new IllegalStateException(C2803.m4871("Top bit not zero: ", iM6692));
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public int m6698() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        int i3 = bArr[i] & 255;
        this.f13228 = i2 + 1;
        return ((bArr[i2] & 255) << 8) | i3;
    }

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public long m6699() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        long j = (((long) bArr[i]) & 255) << 56;
        int i3 = i2 + 1;
        this.f13228 = i3;
        long j2 = j | ((((long) bArr[i2]) & 255) << 48);
        int i4 = i3 + 1;
        this.f13228 = i4;
        long j3 = j2 | ((((long) bArr[i3]) & 255) << 40);
        int i5 = i4 + 1;
        this.f13228 = i5;
        long j4 = j3 | ((((long) bArr[i4]) & 255) << 32);
        int i6 = i5 + 1;
        this.f13228 = i6;
        long j5 = j4 | ((((long) bArr[i5]) & 255) << 24);
        int i7 = i6 + 1;
        this.f13228 = i7;
        long j6 = j5 | ((((long) bArr[i6]) & 255) << 16);
        int i8 = i7 + 1;
        this.f13228 = i8;
        long j7 = j6 | ((((long) bArr[i7]) & 255) << 8);
        this.f13228 = i8 + 1;
        return j7 | (((long) bArr[i8]) & 255);
    }

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public String m6700() {
        if (m6679() == 0) {
            return null;
        }
        int i = this.f13228;
        while (i < this.f13229 && this.f13227[i] != 0) {
            i++;
        }
        byte[] bArr = this.f13227;
        int i2 = this.f13228;
        String strM6761 = C4150.m6761(bArr, i2, i - i2);
        this.f13228 = i;
        if (i < this.f13229) {
            this.f13228 = i + 1;
        }
        return strM6761;
    }

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public int m6701() {
        return (m6702() << 21) | (m6702() << 14) | (m6702() << 7) | m6702();
    }

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public int m6702() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        this.f13228 = i + 1;
        return bArr[i] & 255;
    }

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public long m6703() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        long j = (((long) bArr[i]) & 255) << 24;
        int i3 = i2 + 1;
        this.f13228 = i3;
        long j2 = j | ((((long) bArr[i2]) & 255) << 16);
        int i4 = i3 + 1;
        this.f13228 = i4;
        long j3 = j2 | ((((long) bArr[i3]) & 255) << 8);
        this.f13228 = i4 + 1;
        return j3 | (((long) bArr[i4]) & 255);
    }

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public int m6704() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        int i3 = (bArr[i] & 255) << 16;
        int i4 = i2 + 1;
        this.f13228 = i4;
        int i5 = i3 | ((bArr[i2] & 255) << 8);
        this.f13228 = i4 + 1;
        return (bArr[i4] & 255) | i5;
    }

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public int m6705() {
        int iM6688 = m6688();
        if (iM6688 >= 0) {
            return iM6688;
        }
        throw new IllegalStateException(C2803.m4871("Top bit not zero: ", iM6688));
    }

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public long m6706() {
        long jM6699 = m6699();
        if (jM6699 >= 0) {
            return jM6699;
        }
        throw new IllegalStateException(C2803.m4874("Top bit not zero: ", jM6699));
    }

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public int m6707() {
        byte[] bArr = this.f13227;
        int i = this.f13228;
        int i2 = i + 1;
        this.f13228 = i2;
        int i3 = (bArr[i] & 255) << 8;
        this.f13228 = i2 + 1;
        return (bArr[i2] & 255) | i3;
    }

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public long m6708() {
        int i;
        int i2;
        long j = this.f13227[this.f13228];
        int i3 = 7;
        while (true) {
            if (i3 < 0) {
                break;
            }
            int i4 = 1 << i3;
            if ((((long) i4) & j) != 0) {
                i3--;
            } else if (i3 < 6) {
                j &= (long) (i4 - 1);
                i2 = 7 - i3;
            } else if (i3 == 7) {
                i2 = 1;
            }
        }
        i2 = 0;
        if (i2 == 0) {
            throw new NumberFormatException(C2803.m4874("Invalid UTF-8 sequence first byte: ", j));
        }
        for (i = 1; i < i2; i++) {
            byte b = this.f13227[this.f13228 + i];
            if ((b & 192) != 128) {
                throw new NumberFormatException(C2803.m4874("Invalid UTF-8 sequence continuation byte: ", j));
            }
            j = (j << 6) | ((long) (b & 63));
        }
        this.f13228 += i2;
        return j;
    }

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public void m6709() {
        this.f13228 = 0;
        this.f13229 = 0;
    }
}
