package l5; import com.google.android.gms.ads.RequestConfiguration; import h5.j0; import java.net.ProtocolException; /* loaded from: classes2.dex */ public final class k { /* renamed from: a, reason: collision with root package name */ public final j0 f11625a; /* renamed from: b, reason: collision with root package name */ public final int f11626b; /* renamed from: c, reason: collision with root package name */ public final String f11627c; public k(j0 j0Var, int i10, String str) { this.f11625a = j0Var; this.f11626b = i10; this.f11627c = str; } public static k a(String str) { j0 j0Var; 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) { j0Var = j0.HTTP_1_0; } else { if (charAt != 1) { throw new ProtocolException("Unexpected status line: " + str); } j0Var = j0.HTTP_1_1; } } else { if (!str.startsWith("ICY ")) { throw new ProtocolException("Unexpected status line: " + str); } j0Var = j0.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(j0Var, parseInt, str2); } catch (NumberFormatException unused) { throw new ProtocolException("Unexpected status line: " + str); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.f11625a == j0.HTTP_1_0 ? "HTTP/1.0" : "HTTP/1.1"); sb.append(' '); sb.append(this.f11626b); if (this.f11627c != null) { sb.append(' '); sb.append(this.f11627c); } return sb.toString(); } }