alexandroid/decompiled/jadx/sources/com/amazonaws/transform/StaxUnmarshallerContext.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

143 lines
4.3 KiB
Java

package com.amazonaws.transform;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes6.dex */
public class StaxUnmarshallerContext {
private int currentEventType;
private final Map<String, String> headers;
private Map<String, String> metadata;
private List<MetadataExpression> metadataExpressions;
public final Deque<String> stack;
private String stackString;
private final XmlPullParser xpp;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public static class MetadataExpression {
public String expression;
public String key;
public int targetDepth;
public MetadataExpression(String str, int i, String str2) {
this.expression = str;
this.targetDepth = i;
this.key = str2;
}
}
public StaxUnmarshallerContext(XmlPullParser xmlPullParser, Map<String, String> map) {
this.stack = new LinkedList();
this.stackString = "";
this.metadata = new HashMap();
this.metadataExpressions = new ArrayList();
this.xpp = xmlPullParser;
this.headers = map;
}
private void updateContext() {
int i = this.currentEventType;
if (i != 2) {
if (i == 3) {
this.stack.pop();
this.stackString = this.stack.isEmpty() ? "" : this.stack.peek();
return;
}
return;
}
String str = this.stackString + "/" + this.xpp.getName();
this.stackString = str;
this.stack.push(str);
}
public int getCurrentDepth() {
return this.stack.size();
}
public String getHeader(String str) {
Map<String, String> map = this.headers;
if (map == null) {
return null;
}
return map.get(str);
}
public Map<String, String> getMetadata() {
return this.metadata;
}
public boolean isStartOfDocument() {
return this.currentEventType == 0;
}
public int nextEvent() throws XmlPullParserException, IOException {
int next = this.xpp.next();
this.currentEventType = next;
if (next == 4) {
this.currentEventType = this.xpp.next();
}
updateContext();
if (this.currentEventType == 2) {
Iterator<MetadataExpression> it2 = this.metadataExpressions.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
MetadataExpression next2 = it2.next();
if (testExpression(next2.expression, next2.targetDepth)) {
this.metadata.put(next2.key, readText());
break;
}
}
}
return this.currentEventType;
}
public String readText() throws XmlPullParserException, IOException {
String nextText = this.xpp.nextText();
if (this.xpp.getEventType() != 3) {
this.xpp.next();
}
this.currentEventType = this.xpp.getEventType();
updateContext();
return nextText;
}
public void registerMetadataExpression(String str, int i, String str2) {
this.metadataExpressions.add(new MetadataExpression(str, i, str2));
}
public boolean testExpression(String str, int i) {
if (".".equals(str)) {
return true;
}
int i2 = -1;
while (true) {
i2 = str.indexOf("/", i2 + 1);
if (i2 <= -1) {
break;
}
if (str.charAt(i2 + 1) != '@') {
i++;
}
}
return getCurrentDepth() == i && this.stackString.endsWith("/".concat(str));
}
public StaxUnmarshallerContext(XmlPullParser xmlPullParser) {
this(xmlPullParser, null);
}
public boolean testExpression(String str) {
return testExpression(str, getCurrentDepth());
}
}