package o; import java.io.IOException; import java.net.ProtocolException; /* renamed from: o.fNo, reason: case insensitive filesystem */ /* loaded from: classes5.dex */ public final class C13002fNo { public final String a; private EnumC12997fNj d; public final int e; private C13002fNo(EnumC12997fNj enumC12997fNj, int i, String str) { this.d = enumC12997fNj; this.e = i; this.a = str; } public static C13002fNo c(String str) throws IOException { EnumC12997fNj enumC12997fNj; int i; String str2; if (str.startsWith("HTTP/1.")) { i = 9; if (str.length() < 9 || str.charAt(8) != ' ') { throw new ProtocolException("Unexpected status line: ".concat(String.valueOf(str))); } int charAt = str.charAt(7) - '0'; if (charAt == 0) { enumC12997fNj = EnumC12997fNj.HTTP_1_0; } else if (charAt == 1) { enumC12997fNj = EnumC12997fNj.HTTP_1_1; } else { throw new ProtocolException("Unexpected status line: ".concat(String.valueOf(str))); } } else if (str.startsWith("ICY ")) { enumC12997fNj = EnumC12997fNj.HTTP_1_0; i = 4; } else { throw new ProtocolException("Unexpected status line: ".concat(String.valueOf(str))); } int i2 = i + 3; if (str.length() < i2) { throw new ProtocolException("Unexpected status line: ".concat(String.valueOf(str))); } try { int parseInt = Integer.parseInt(str.substring(i, i2)); if (str.length() <= i2) { str2 = ""; } else { if (str.charAt(i2) != ' ') { throw new ProtocolException("Unexpected status line: ".concat(String.valueOf(str))); } str2 = str.substring(i + 4); } return new C13002fNo(enumC12997fNj, parseInt, str2); } catch (NumberFormatException unused) { throw new ProtocolException("Unexpected status line: ".concat(String.valueOf(str))); } } public final String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.d == EnumC12997fNj.HTTP_1_0 ? "HTTP/1.0" : "HTTP/1.1"); sb.append(' '); sb.append(this.e); if (this.a != null) { sb.append(' '); sb.append(this.a); } return sb.toString(); } }