package r9; import com.google.android.gms.ads.RequestConfiguration; import java.net.ProtocolException; import n9.c0; /* loaded from: classes2.dex */ public final class k { /* renamed from: a, reason: collision with root package name */ public final c0 f13764a; /* renamed from: b, reason: collision with root package name */ public final int f13765b; /* renamed from: c, reason: collision with root package name */ public final String f13766c; public k(c0 c0Var, int i10, String str) { this.f13764a = c0Var; this.f13765b = i10; this.f13766c = str; } public static k a(String str) { c0 c0Var; int i10; String str2; if (str.startsWith("HTTP/1.")) { i10 = 9; if (str.length() < 9 || str.charAt(8) != ' ') { throw new ProtocolException("Unexpected status line: " + str); } int charAt = str.charAt(7) - '0'; if (charAt == 0) { c0Var = c0.HTTP_1_0; } else { if (charAt != 1) { throw new ProtocolException("Unexpected status line: " + str); } c0Var = c0.HTTP_1_1; } } else { if (!str.startsWith("ICY ")) { throw new ProtocolException("Unexpected status line: " + str); } c0Var = c0.HTTP_1_0; i10 = 4; } int i11 = i10 + 3; if (str.length() < i11) { throw new ProtocolException("Unexpected status line: " + str); } try { int parseInt = Integer.parseInt(str.substring(i10, i11)); if (str.length() <= i11) { str2 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; } else { if (str.charAt(i11) != ' ') { throw new ProtocolException("Unexpected status line: " + str); } str2 = str.substring(i10 + 4); } return new k(c0Var, parseInt, str2); } catch (NumberFormatException unused) { throw new ProtocolException("Unexpected status line: " + str); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.f13764a == c0.HTTP_1_0 ? "HTTP/1.0" : "HTTP/1.1"); sb.append(' '); sb.append(this.f13765b); if (this.f13766c != null) { sb.append(' '); sb.append(this.f13766c); } return sb.toString(); } }