package rn0; import android.text.TextUtils; import android.util.Xml; import com.tencent.midas.comm.log.util.APLogFileUtil; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import qn0.b; import qn0.f; import tn0.a; public class u { /* renamed from: a reason: collision with root package name */ public XmlPullParser f296637a = Xml.newPullParser(); public static u a() { return new u(); } public HashMap<String, a> b(String str) { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(str.getBytes()); HashMap<String, a> hashMap = new HashMap<>(); try { this.f296637a.setInput(byteArrayInputStream, "utf-8"); this.f296637a.setFeature("http://xmlpull.org/v1/doc/features.html#process-namespaces", true); int eventType = this.f296637a.getEventType(); while (eventType != 1) { String name = this.f296637a.getName(); if (name == null) { eventType = this.f296637a.next(); } else { if (eventType == 2) { a aVar = new a(); int attributeCount = this.f296637a.getAttributeCount(); for (int i15 = 0; i15 < attributeCount; i15++) { aVar.f313141b.b(this.f296637a.getAttributeName(i15), this.f296637a.getAttributeValue(i15)); } int next = this.f296637a.next(); if (next == 2) { hashMap.put(name, aVar); eventType = next; } else if (next == 4) { aVar.f313140a = this.f296637a.getText().trim(); hashMap.put(name, aVar); } else if (next == 3) { hashMap.put(name, aVar); } } eventType = this.f296637a.next(); } } } catch (IOException | XmlPullParserException unused) { } return hashMap; } public b c(InputStream inputStream) { b bVar; synchronized (u.class) { b bVar2 = null; try { this.f296637a.setInput(inputStream, "utf-8"); int eventType = this.f296637a.getEventType(); bVar = new b(); f fVar = null; while (eventType != 1) { if (eventType == 2) { String name = this.f296637a.getName(); if ("major".equalsIgnoreCase(name)) { String nextText = this.f296637a.nextText(); if (!TextUtils.isEmpty(nextText)) { bVar.f290425d = Integer.parseInt(nextText); } } else if ("minor".equalsIgnoreCase(name)) { String nextText2 = this.f296637a.nextText(); if (!TextUtils.isEmpty(nextText2)) { bVar.f290426e = Integer.parseInt(nextText2); } } else if ("deviceType".equalsIgnoreCase(name)) { bVar.f290427f = this.f296637a.nextText(); } else if ("friendlyName".equalsIgnoreCase(name)) { bVar.f290428g = this.f296637a.nextText(); } else if ("UDN".equalsIgnoreCase(name)) { bVar.f290430i = this.f296637a.nextText(); } else if ("manufacturer".equalsIgnoreCase(name)) { bVar.f290429h = this.f296637a.nextText(); } else if ("service".equalsIgnoreCase(name)) { fVar = new f(); } else if ("serviceType".equalsIgnoreCase(name)) { if (fVar != null) { fVar.f290453a = this.f296637a.nextText(); } } else if ("serviceId".equalsIgnoreCase(name)) { if (fVar != null) { fVar.f290454b = this.f296637a.nextText(); } } else if ("controlURL".equalsIgnoreCase(name)) { if (fVar != null) { fVar.f290456d = this.f296637a.nextText(); } } else if ("eventSubURL".equalsIgnoreCase(name)) { if (fVar != null) { fVar.f290457e = this.f296637a.nextText(); } } else if ("SCPDURL".equalsIgnoreCase(name) && fVar != null) { fVar.f290455c = this.f296637a.nextText(); } } else if (eventType == 3) { try { if ("service".equalsIgnoreCase(this.f296637a.getName()) && fVar != null) { bVar.f290431j.add(fVar); fVar = null; } } catch (IOException | XmlPullParserException unused) { bVar2 = bVar; bVar = bVar2; return bVar; } } eventType = this.f296637a.next(); } } catch (IOException | XmlPullParserException unused2) { bVar = bVar2; return bVar; } } return bVar; } public tn0.b d(String str) { tn0.b bVar = null; if (str == null) { return null; } if (str.startsWith("NOTIFY") || str.startsWith("HTTP")) { bVar = new tn0.b(); String[] split = str.split(APLogFileUtil.SEPARATOR_LINE); if (split.length > 0) { String[] split2 = split[0].split(" "); if (split2[0].startsWith("HTTP")) { bVar.b("VERSION", split2[0]); bVar.b("RESPONSE_CODE", split2[1]); bVar.b("RESPONSE_DESCRIPTION", split2[2]); } else { bVar.b("METHOD", split2[0]); bVar.b("PATH", split2[1]); bVar.b("VERSION", split2[2]); } } for (int i15 = 1; i15 < split.length; i15++) { String str2 = split[i15]; int indexOf = str2.indexOf(":"); bVar.b(str2.substring(0, indexOf).toUpperCase(), str2.substring(indexOf + 1, str2.length()).trim()); } } return bVar; } }