package com.facetec.sdk; import java.io.IOException; import java.net.ProtocolException; /* loaded from: classes.dex */ public final class lm { public final kd b; public final int c; public final String d; private lm(kd kdVar, int i, String str) { this.b = kdVar; this.c = i; this.d = str; } public static lm e(String str) throws IOException { kd kdVar; 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) { kdVar = kd.HTTP_1_0; } else if (charAt == 1) { kdVar = kd.HTTP_1_1; } else { throw new ProtocolException("Unexpected status line: ".concat(String.valueOf(str))); } } else if (str.startsWith("ICY ")) { kdVar = kd.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 lm(kdVar, 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.b == kd.HTTP_1_0 ? "HTTP/1.0" : "HTTP/1.1"); sb.append(' '); sb.append(this.c); if (this.d != null) { sb.append(' '); sb.append(this.d); } return sb.toString(); } }