package p447.p448.p453;

import java.net.ProtocolException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import p138.p139.p143.p144.C2803;
import p402.InterfaceC6540;
import p402.p411.p413.C6635;
import p402.p420.C6703;
import p447.EnumC6924;

/* JADX INFO: renamed from: ސ.ޣ.ޅ.އ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@InterfaceC6540
public final class C6991 {

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public static final C6992 f20343 = new C6992(null);

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final EnumC6924 f20344;

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

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final String f20346;

    /* JADX INFO: renamed from: ސ.ޣ.ޅ.އ$֏, reason: contains not printable characters */
    public static final class C6992 {
        public C6992() {
        }

        public /* synthetic */ C6992(DefaultConstructorMarker defaultConstructorMarker) {
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final C6991 m10270(String str) throws ProtocolException {
            EnumC6924 enumC6924;
            String strSubstring;
            if (str == null) {
                C6635.m9824("statusLine");
                throw null;
            }
            int i = 9;
            if (C6703.m9899(str, "HTTP/1.", false, 2)) {
                if (str.length() < 9 || str.charAt(8) != ' ') {
                    throw new ProtocolException(C2803.m4879("Unexpected status line: ", str));
                }
                int iCharAt = str.charAt(7) - '0';
                if (iCharAt == 0) {
                    enumC6924 = EnumC6924.HTTP_1_0;
                } else {
                    if (iCharAt != 1) {
                        throw new ProtocolException(C2803.m4879("Unexpected status line: ", str));
                    }
                    enumC6924 = EnumC6924.HTTP_1_1;
                }
            } else {
                if (!C6703.m9899(str, "ICY ", false, 2)) {
                    throw new ProtocolException(C2803.m4879("Unexpected status line: ", str));
                }
                enumC6924 = EnumC6924.HTTP_1_0;
                i = 4;
            }
            int i2 = i + 3;
            if (str.length() < i2) {
                throw new ProtocolException(C2803.m4879("Unexpected status line: ", str));
            }
            try {
                String strSubstring2 = str.substring(i, i2);
                C6635.m9823((Object) strSubstring2, "(this as java.lang.Strin…ing(startIndex, endIndex)");
                int i3 = Integer.parseInt(strSubstring2);
                if (str.length() <= i2) {
                    strSubstring = "";
                } else {
                    if (str.charAt(i2) != ' ') {
                        throw new ProtocolException(C2803.m4879("Unexpected status line: ", str));
                    }
                    strSubstring = str.substring(i + 4);
                    C6635.m9823((Object) strSubstring, "(this as java.lang.String).substring(startIndex)");
                }
                return new C6991(enumC6924, i3, strSubstring);
            } catch (NumberFormatException unused) {
                throw new ProtocolException(C2803.m4879("Unexpected status line: ", str));
            }
        }
    }

    public C6991(EnumC6924 enumC6924, int i, String str) {
        if (enumC6924 == null) {
            C6635.m9824("protocol");
            throw null;
        }
        if (str == null) {
            C6635.m9824("message");
            throw null;
        }
        this.f20344 = enumC6924;
        this.f20345 = i;
        this.f20346 = str;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        if (this.f20344 == EnumC6924.HTTP_1_0) {
            sb.append("HTTP/1.0");
        } else {
            sb.append("HTTP/1.1");
        }
        sb.append(' ');
        sb.append(this.f20345);
        sb.append(' ');
        sb.append(this.f20346);
        String string = sb.toString();
        C6635.m9823((Object) string, "StringBuilder().apply(builderAction).toString()");
        return string;
    }
}
