Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
package com.amazonaws.util;
import com.amazonaws.metrics.MetricType;
@Deprecated
/* loaded from: classes.dex */
public class AWSRequestMetrics {
public final TimingInfo timingInfo;
public enum Field implements MetricType {
AWSErrorCode,
AWSRequestID,
BytesProcessed,
ClientExecuteTime,
CredentialsRequestTime,
Exception,
HttpRequestTime,
RedirectLocation,
RequestMarshallTime,
RequestSigningTime,
ResponseProcessingTime,
RequestCount,
RetryCount,
HttpClientRetryCount,
HttpClientSendRequestTime,
HttpClientReceiveResponseTime,
RetryPauseTime,
ServiceEndpoint,
ServiceName,
StatusCode
}
public void addProperty(MetricType metricType, Object obj) {
}
public void endEvent(MetricType metricType) {
}
public final TimingInfo getTimingInfo() {
return this.timingInfo;
}
public void incrementCounter(MetricType metricType) {
}
public void log() {
}
public void setCounter(MetricType metricType, long j) {
}
public void startEvent(MetricType metricType) {
}
public AWSRequestMetrics() {
this.timingInfo = TimingInfo.startTiming();
}
public AWSRequestMetrics(TimingInfo timingInfo) {
this.timingInfo = timingInfo;
}
}

View File

@@ -0,0 +1,106 @@
package com.amazonaws.util;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.metrics.MetricType;
import com.ironsource.v8;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Deprecated
/* loaded from: classes.dex */
public class AWSRequestMetricsFullSupport extends AWSRequestMetrics {
public final Map eventsBeingProfiled;
public final Map properties;
public static final Log LATENCY_LOGGER = LogFactory.getLog("com.amazonaws.latency");
public static final Object KEY_VALUE_SEPARATOR = v8.i.b;
public static final Object COMMA_SEPARATOR = ", ";
public AWSRequestMetricsFullSupport() {
super(TimingInfo.startTimingFullSupport());
this.properties = new HashMap();
this.eventsBeingProfiled = new HashMap();
}
public void startEvent(String str) {
this.eventsBeingProfiled.put(str, TimingInfo.startTimingFullSupport(System.nanoTime()));
}
@Override // com.amazonaws.util.AWSRequestMetrics
public void startEvent(MetricType metricType) {
startEvent(metricType.name());
}
public void endEvent(String str) {
TimingInfo timingInfo = (TimingInfo) this.eventsBeingProfiled.get(str);
if (timingInfo == null) {
LogFactory.getLog(getClass()).warn("Trying to end an event which was never started: " + str);
return;
}
timingInfo.endTiming();
this.timingInfo.addSubMeasurement(str, TimingInfo.unmodifiableTimingInfo(timingInfo.getStartTimeNano(), Long.valueOf(timingInfo.getEndTimeNano())));
}
@Override // com.amazonaws.util.AWSRequestMetrics
public void endEvent(MetricType metricType) {
endEvent(metricType.name());
}
public void incrementCounter(String str) {
this.timingInfo.incrementCounter(str);
}
@Override // com.amazonaws.util.AWSRequestMetrics
public void incrementCounter(MetricType metricType) {
incrementCounter(metricType.name());
}
public void setCounter(String str, long j) {
this.timingInfo.setCounter(str, j);
}
@Override // com.amazonaws.util.AWSRequestMetrics
public void setCounter(MetricType metricType, long j) {
setCounter(metricType.name(), j);
}
public void addProperty(String str, Object obj) {
List list = (List) this.properties.get(str);
if (list == null) {
list = new ArrayList();
this.properties.put(str, list);
}
list.add(obj);
}
@Override // com.amazonaws.util.AWSRequestMetrics
public void addProperty(MetricType metricType, Object obj) {
addProperty(metricType.name(), obj);
}
@Override // com.amazonaws.util.AWSRequestMetrics
public void log() {
if (LATENCY_LOGGER.isInfoEnabled()) {
StringBuilder sb = new StringBuilder();
for (Map.Entry entry : this.properties.entrySet()) {
keyValueFormat(entry.getKey(), entry.getValue(), sb);
}
for (Map.Entry entry2 : this.timingInfo.getAllCounters().entrySet()) {
keyValueFormat(entry2.getKey(), entry2.getValue(), sb);
}
for (Map.Entry entry3 : this.timingInfo.getSubMeasurementsByName().entrySet()) {
keyValueFormat(entry3.getKey(), entry3.getValue(), sb);
}
LATENCY_LOGGER.info(sb.toString());
}
}
public final void keyValueFormat(Object obj, Object obj2, StringBuilder sb) {
sb.append(obj);
sb.append(KEY_VALUE_SEPARATOR);
sb.append(obj2);
sb.append(COMMA_SEPARATOR);
}
}

View File

@@ -0,0 +1,19 @@
package com.amazonaws.util;
import com.amazonaws.metrics.MetricType;
@Deprecated
/* loaded from: classes.dex */
public enum AWSServiceMetrics implements MetricType {
HttpClientGetConnectionTime("HttpClient");
private final String serviceName;
public String getServiceName() {
return this.serviceName;
}
AWSServiceMetrics(String str) {
this.serviceName = str;
}
}

View File

@@ -0,0 +1,71 @@
package com.amazonaws.util;
import com.amazonaws.internal.config.HostRegexToRegionMapping;
import com.amazonaws.internal.config.InternalConfig;
import java.net.URI;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* loaded from: classes.dex */
public abstract class AwsHostNameUtils {
public static final Pattern S3_ENDPOINT_PATTERN = Pattern.compile("^(?:.+\\.)?s3[.-]([a-z0-9-]+)$");
public static String parseRegionName(String str, String str2) {
if (str == null) {
throw new IllegalArgumentException("hostname cannot be null");
}
String parseRegionNameByInternalConfig = parseRegionNameByInternalConfig(str);
if (parseRegionNameByInternalConfig != null) {
return parseRegionNameByInternalConfig;
}
if (str.endsWith(".amazonaws.com")) {
return parseStandardRegionName(str.substring(0, str.length() - 14));
}
if (str.endsWith(".amazonaws.com.cn")) {
return parseStandardRegionName(str.substring(0, str.length() - 17));
}
if (str2 == null) {
return "us-east-1";
}
Matcher matcher = Pattern.compile("^(?:.+\\.)?" + Pattern.quote(str2) + "[.-]([a-z0-9-]+)\\.").matcher(str);
return matcher.find() ? matcher.group(1) : "us-east-1";
}
public static String parseStandardRegionName(String str) {
Matcher matcher = S3_ENDPOINT_PATTERN.matcher(str);
if (matcher.matches()) {
return matcher.group(1);
}
int lastIndexOf = str.lastIndexOf(46);
if (lastIndexOf == -1) {
return "us-east-1";
}
String substring = str.substring(lastIndexOf + 1);
if (substring.equals("vpce")) {
String[] split = str.split("\\.");
if (split.length < 2) {
return "us-east-1";
}
substring = split[split.length - 2];
}
return "us-gov".equals(substring) ? "us-gov-west-1" : substring;
}
public static String parseRegionNameByInternalConfig(String str) {
for (HostRegexToRegionMapping hostRegexToRegionMapping : InternalConfig.Factory.getInternalConfig().getHostRegexToRegionMappings()) {
if (str.matches(hostRegexToRegionMapping.getHostNameRegex())) {
return hostRegexToRegionMapping.getRegionName();
}
}
return null;
}
public static String parseServiceName(URI uri) {
String host = uri.getHost();
if (!host.endsWith(".amazonaws.com")) {
throw new IllegalArgumentException("Cannot parse a service name from an unrecognized endpoint (" + host + ").");
}
String substring = host.substring(0, host.indexOf(".amazonaws.com"));
return (substring.endsWith(".s3") || S3_ENDPOINT_PATTERN.matcher(substring).matches()) ? "s3" : substring.indexOf(46) == -1 ? substring : substring.substring(0, substring.indexOf(46));
}
}

View File

@@ -0,0 +1,34 @@
package com.amazonaws.util;
/* loaded from: classes.dex */
public enum Base64 {
;
private static final Base64Codec CODEC = new Base64Codec();
public static String encodeAsString(byte... bArr) {
if (bArr == null) {
return null;
}
return bArr.length == 0 ? "" : CodecUtils.toStringDirect(CODEC.encode(bArr));
}
public static byte[] encode(byte[] bArr) {
return (bArr == null || bArr.length == 0) ? bArr : CODEC.encode(bArr);
}
public static byte[] decode(String str) {
if (str == null) {
return null;
}
if (str.length() == 0) {
return new byte[0];
}
byte[] bArr = new byte[str.length()];
return CODEC.decode(bArr, CodecUtils.sanitize(str, bArr));
}
public static byte[] decode(byte[] bArr) {
return (bArr == null || bArr.length == 0) ? bArr : CODEC.decode(bArr, bArr.length);
}
}

View File

@@ -0,0 +1,169 @@
package com.amazonaws.util;
import com.applovin.exoplayer2.common.base.Ascii;
/* loaded from: classes.dex */
class Base64Codec {
public final byte[] alpahbets = CodecUtils.toBytesDirect("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
public static class LazyHolder {
public static final byte[] DECODED = decodeTable();
public static byte[] decodeTable() {
byte[] bArr = new byte[123];
for (int i = 0; i <= 122; i++) {
if (i >= 65 && i <= 90) {
bArr[i] = (byte) (i - 65);
} else if (i >= 48 && i <= 57) {
bArr[i] = (byte) (i + 4);
} else if (i == 43) {
bArr[i] = (byte) (i + 19);
} else if (i == 47) {
bArr[i] = (byte) (i + 16);
} else if (i >= 97 && i <= 122) {
bArr[i] = (byte) (i - 71);
} else {
bArr[i] = -1;
}
}
return bArr;
}
}
public byte[] encode(byte[] bArr) {
int length = bArr.length / 3;
int length2 = bArr.length % 3;
int i = 0;
if (length2 == 0) {
byte[] bArr2 = new byte[length * 4];
int i2 = 0;
while (i < bArr.length) {
encode3bytes(bArr, i, bArr2, i2);
i += 3;
i2 += 4;
}
return bArr2;
}
byte[] bArr3 = new byte[(length + 1) * 4];
int i3 = 0;
while (i < bArr.length - length2) {
encode3bytes(bArr, i, bArr3, i3);
i += 3;
i3 += 4;
}
if (length2 == 1) {
encode1byte(bArr, i, bArr3, i3);
} else if (length2 == 2) {
encode2bytes(bArr, i, bArr3, i3);
}
return bArr3;
}
public void encode3bytes(byte[] bArr, int i, byte[] bArr2, int i2) {
byte[] bArr3 = this.alpahbets;
byte b = bArr[i];
bArr2[i2] = bArr3[(b >>> 2) & 63];
byte b2 = bArr[i + 1];
bArr2[i2 + 1] = bArr3[((b & 3) << 4) | ((b2 >>> 4) & 15)];
int i3 = (b2 & Ascii.SI) << 2;
byte b3 = bArr[i + 2];
bArr2[i2 + 2] = bArr3[((b3 >>> 6) & 3) | i3];
bArr2[i2 + 3] = bArr3[b3 & 63];
}
public void encode2bytes(byte[] bArr, int i, byte[] bArr2, int i2) {
byte[] bArr3 = this.alpahbets;
int i3 = i + 1;
byte b = bArr[i];
bArr2[i2] = bArr3[(b >>> 2) & 63];
byte b2 = bArr[i3];
bArr2[i2 + 1] = bArr3[((b & 3) << 4) | ((b2 >>> 4) & 15)];
bArr2[i2 + 2] = bArr3[(b2 & Ascii.SI) << 2];
bArr2[i2 + 3] = 61;
}
public void encode1byte(byte[] bArr, int i, byte[] bArr2, int i2) {
byte[] bArr3 = this.alpahbets;
byte b = bArr[i];
bArr2[i2] = bArr3[(b >>> 2) & 63];
bArr2[i2 + 1] = bArr3[(b & 3) << 4];
bArr2[i2 + 2] = 61;
bArr2[i2 + 3] = 61;
}
public void decode4bytes(byte[] bArr, int i, byte[] bArr2, int i2) {
int pos = pos(bArr[i]) << 2;
int pos2 = pos(bArr[i + 1]);
bArr2[i2] = (byte) (pos | ((pos2 >>> 4) & 3));
int pos3 = pos(bArr[i + 2]);
bArr2[i2 + 1] = (byte) (((pos2 & 15) << 4) | ((pos3 >>> 2) & 15));
bArr2[i2 + 2] = (byte) (pos(bArr[i + 3]) | ((pos3 & 3) << 6));
}
public void decode1to3bytes(int i, byte[] bArr, int i2, byte[] bArr2, int i3) {
int i4 = i3 + 1;
int pos = pos(bArr[i2]) << 2;
int i5 = i2 + 2;
int pos2 = pos(bArr[i2 + 1]);
bArr2[i3] = (byte) (pos | ((pos2 >>> 4) & 3));
if (i == 1) {
CodecUtils.sanityCheckLastPos(pos2, 15);
return;
}
int i6 = i3 + 2;
int i7 = i2 + 3;
int pos3 = pos(bArr[i5]);
bArr2[i4] = (byte) (((pos2 & 15) << 4) | (15 & (pos3 >>> 2)));
if (i == 2) {
CodecUtils.sanityCheckLastPos(pos3, 3);
} else {
bArr2[i6] = (byte) (((pos3 & 3) << 6) | pos(bArr[i7]));
}
}
public byte[] decode(byte[] bArr, int i) {
int i2;
if (i % 4 != 0) {
throw new IllegalArgumentException("Input is expected to be encoded in multiple of 4 bytes but found: " + i);
}
int i3 = i - 1;
int i4 = 0;
while (true) {
i2 = 2;
if (i4 >= 2 || i3 <= -1 || bArr[i3] != 61) {
break;
}
i3--;
i4++;
}
if (i4 == 0) {
i2 = 3;
} else if (i4 != 1) {
if (i4 != 2) {
throw new Error("Impossible");
}
i2 = 1;
}
int i5 = ((i / 4) * 3) - (3 - i2);
byte[] bArr2 = new byte[i5];
int i6 = 0;
int i7 = 0;
while (i7 < i5 - (i2 % 3)) {
decode4bytes(bArr, i6, bArr2, i7);
i6 += 4;
i7 += 3;
}
if (i2 < 3) {
decode1to3bytes(i2, bArr, i6, bArr2, i7);
}
return bArr2;
}
public int pos(byte b) {
byte b2 = LazyHolder.DECODED[b];
if (b2 > -1) {
return b2;
}
throw new IllegalArgumentException("Invalid base 64 character: '" + ((char) b) + "'");
}
}

View File

@@ -0,0 +1,22 @@
package com.amazonaws.util;
/* loaded from: classes.dex */
public abstract class BinaryUtils {
public static String toHex(byte[] bArr) {
StringBuilder sb = new StringBuilder(bArr.length * 2);
for (byte b : bArr) {
String hexString = Integer.toHexString(b);
if (hexString.length() == 1) {
sb.append("0");
} else if (hexString.length() == 8) {
hexString = hexString.substring(6);
}
sb.append(hexString);
}
return StringUtils.lowerCase(sb.toString());
}
public static String toBase64(byte[] bArr) {
return Base64.encodeAsString(bArr);
}
}

View File

@@ -0,0 +1,47 @@
package com.amazonaws.util;
import com.amazonaws.internal.SdkFilterInputStream;
import java.io.FilterInputStream;
import java.io.InputStream;
import java.util.zip.CRC32;
/* loaded from: classes.dex */
public class CRC32ChecksumCalculatingInputStream extends SdkFilterInputStream {
public CRC32 crc32;
public CRC32ChecksumCalculatingInputStream(InputStream inputStream) {
super(inputStream);
this.crc32 = new CRC32();
}
public long getCRC32Checksum() {
return this.crc32.getValue();
}
@Override // com.amazonaws.internal.SdkFilterInputStream, java.io.FilterInputStream, java.io.InputStream
public synchronized void reset() {
abortIfNeeded();
this.crc32.reset();
((FilterInputStream) this).in.reset();
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read() {
abortIfNeeded();
int read = ((FilterInputStream) this).in.read();
if (read != -1) {
this.crc32.update(read);
}
return read;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read(byte[] bArr, int i, int i2) {
abortIfNeeded();
int read = ((FilterInputStream) this).in.read(bArr, i, i2);
if (read != -1) {
this.crc32.update(bArr, i, read);
}
return read;
}
}

View File

@@ -0,0 +1,117 @@
package com.amazonaws.util;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
/* loaded from: classes.dex */
public enum ClassLoaderHelper {
;
public static URL getResource(String str, Class<?>... clsArr) {
return getResource(str, false, clsArr);
}
public static URL getResource(String str, boolean z, Class<?>... clsArr) {
URL resourceViaContext;
if (z) {
resourceViaContext = getResourceViaClasses(str, clsArr);
if (resourceViaContext == null) {
resourceViaContext = getResourceViaContext(str);
}
} else {
resourceViaContext = getResourceViaContext(str);
if (resourceViaContext == null) {
resourceViaContext = getResourceViaClasses(str, clsArr);
}
}
return resourceViaContext == null ? ClassLoaderHelper.class.getResource(str) : resourceViaContext;
}
private static URL getResourceViaClasses(String str, Class<?>[] clsArr) {
if (clsArr == null) {
return null;
}
for (Class<?> cls : clsArr) {
URL resource = cls.getResource(str);
if (resource != null) {
return resource;
}
}
return null;
}
private static URL getResourceViaContext(String str) {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader == null) {
return null;
}
return contextClassLoader.getResource(str);
}
private static Class<?> loadClassViaClasses(String str, Class<?>[] clsArr) {
if (clsArr == null) {
return null;
}
for (Class<?> cls : clsArr) {
ClassLoader classLoader = cls.getClassLoader();
if (classLoader != null) {
try {
return classLoader.loadClass(str);
} catch (ClassNotFoundException unused) {
continue;
}
}
}
return null;
}
private static Class<?> loadClassViaContext(String str) {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader == null) {
return null;
}
try {
return contextClassLoader.loadClass(str);
} catch (ClassNotFoundException unused) {
return null;
}
}
public static Class<?> loadClass(String str, Class<?>... clsArr) throws ClassNotFoundException {
return loadClass(str, true, clsArr);
}
public static Class<?> loadClass(String str, boolean z, Class<?>... clsArr) throws ClassNotFoundException {
Class<?> loadClassViaContext;
if (z) {
loadClassViaContext = loadClassViaClasses(str, clsArr);
if (loadClassViaContext == null) {
loadClassViaContext = loadClassViaContext(str);
}
} else {
loadClassViaContext = loadClassViaContext(str);
if (loadClassViaContext == null) {
loadClassViaContext = loadClassViaClasses(str, clsArr);
}
}
return loadClassViaContext == null ? Class.forName(str) : loadClassViaContext;
}
public static InputStream getResourceAsStream(String str, Class<?>... clsArr) {
return getResourceAsStream(str, false, clsArr);
}
public static InputStream getResourceAsStream(String str, boolean z, Class<?>... clsArr) {
URL resource = getResource(str, z, clsArr);
if (resource == null) {
return null;
}
try {
return FirebasePerfUrlConnection.openStream(resource);
} catch (IOException unused) {
return null;
}
}
}

View File

@@ -0,0 +1,53 @@
package com.amazonaws.util;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.jar.JarFile;
/* loaded from: classes.dex */
public enum Classes {
;
public static Class<?> childClassOf(Class<?> cls, Object obj) {
if (obj == null || obj == Object.class) {
return null;
}
if (cls != null && cls.isInterface()) {
return null;
}
Class<?> cls2 = obj.getClass();
while (true) {
Class<? super Object> superclass = cls2.getSuperclass();
if (superclass == cls) {
return cls2;
}
if (superclass == null) {
return null;
}
cls2 = superclass;
}
}
public static JarFile jarFileOf(Class<?> cls) {
URL resource = cls.getResource("/" + cls.getName().replace('.', '/') + ".class");
if (resource == null) {
return null;
}
String file = resource.getFile();
int indexOf = file.indexOf("file:") + 5;
int indexOf2 = file.indexOf(".jar!");
if (indexOf2 == -1) {
return null;
}
File file2 = new File(file.substring(indexOf, indexOf2 + 4));
try {
if (file2.exists()) {
return new JarFile(file2);
}
return null;
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}

View File

@@ -0,0 +1,56 @@
package com.amazonaws.util;
/* loaded from: classes.dex */
public enum CodecUtils {
;
public static int sanitize(String str, byte[] bArr) {
int length = bArr.length;
char[] charArray = str.toCharArray();
int i = 0;
for (int i2 = 0; i2 < length; i2++) {
char c = charArray[i2];
if (c != '\r' && c != '\n' && c != ' ') {
if (c > 127) {
throw new IllegalArgumentException("Invalid character found at position " + i2 + " for " + str);
}
bArr[i] = (byte) c;
i++;
}
}
return i;
}
public static byte[] toBytesDirect(String str) {
char[] charArray = str.toCharArray();
int length = charArray.length;
byte[] bArr = new byte[length];
for (int i = 0; i < length; i++) {
char c = charArray[i];
if (c > 127) {
throw new IllegalArgumentException("Invalid character found at position " + i + " for " + str);
}
bArr[i] = (byte) c;
}
return bArr;
}
public static String toStringDirect(byte[] bArr) {
char[] cArr = new char[bArr.length];
int length = bArr.length;
int i = 0;
int i2 = 0;
while (i < length) {
cArr[i2] = (char) bArr[i];
i++;
i2++;
}
return new String(cArr);
}
public static void sanityCheckLastPos(int i, int i2) {
if ((i & i2) != 0) {
throw new IllegalArgumentException("Invalid last non-pad character detected");
}
}
}

View File

@@ -0,0 +1,69 @@
package com.amazonaws.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
/* loaded from: classes.dex */
public abstract class DateUtils {
public static final TimeZone GMT_TIMEZONE = TimeZone.getTimeZone("GMT");
public static final Map SDF_MAP = new HashMap();
public static ThreadLocal getSimpleDateFormat(final String str) {
Map map = SDF_MAP;
ThreadLocal<SimpleDateFormat> threadLocal = (ThreadLocal) map.get(str);
if (threadLocal == null) {
synchronized (map) {
try {
threadLocal = (ThreadLocal) map.get(str);
if (threadLocal == null) {
threadLocal = new ThreadLocal<SimpleDateFormat>() { // from class: com.amazonaws.util.DateUtils.1
@Override // java.lang.ThreadLocal
public SimpleDateFormat initialValue() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str, Locale.US);
simpleDateFormat.setTimeZone(DateUtils.GMT_TIMEZONE);
simpleDateFormat.setLenient(false);
return simpleDateFormat;
}
};
map.put(str, threadLocal);
}
} finally {
}
}
}
return threadLocal;
}
public static Date parse(String str, String str2) {
try {
return ((SimpleDateFormat) getSimpleDateFormat(str).get()).parse(str2);
} catch (ParseException e) {
throw new IllegalArgumentException(e);
}
}
public static String format(String str, Date date) {
return ((SimpleDateFormat) getSimpleDateFormat(str).get()).format(date);
}
public static Date parseISO8601Date(String str) {
try {
return parse("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", str);
} catch (IllegalArgumentException unused) {
return parse("yyyy-MM-dd'T'HH:mm:ss'Z'", str);
}
}
public static Date parseRFC822Date(String str) {
return parse("EEE, dd MMM yyyy HH:mm:ss z", str);
}
public static Date parseCompressedISO8601Date(String str) {
return parse("yyyyMMdd'T'HHmmss'Z'", str);
}
}

View File

@@ -0,0 +1,129 @@
package com.amazonaws.util;
import androidx.webkit.ProxyConfig;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.ironsource.v8;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* loaded from: classes.dex */
public abstract class HttpUtils {
public static final Pattern DECODED_CHARACTERS_PATTERN;
public static final Pattern ENCODED_CHARACTERS_PATTERN = Pattern.compile(Pattern.quote("+") + "|" + Pattern.quote(ProxyConfig.MATCH_ALL_SCHEMES) + "|" + Pattern.quote("%7E") + "|" + Pattern.quote("%2F"));
static {
StringBuilder sb = new StringBuilder();
sb.append(Pattern.quote("%2A"));
sb.append("|");
sb.append(Pattern.quote("%2B"));
sb.append("|");
DECODED_CHARACTERS_PATTERN = Pattern.compile(sb.toString());
}
public static String urlEncode(String str, boolean z) {
if (str == null) {
return "";
}
try {
String encode = URLEncoder.encode(str, "UTF-8");
Matcher matcher = ENCODED_CHARACTERS_PATTERN.matcher(encode);
StringBuffer stringBuffer = new StringBuffer(encode.length());
while (matcher.find()) {
String group = matcher.group(0);
if ("+".equals(group)) {
group = "%20";
} else if (ProxyConfig.MATCH_ALL_SCHEMES.equals(group)) {
group = "%2A";
} else if ("%7E".equals(group)) {
group = "~";
} else if (z && "%2F".equals(group)) {
group = "/";
}
matcher.appendReplacement(stringBuffer, group);
}
matcher.appendTail(stringBuffer);
return stringBuffer.toString();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
public static boolean isUsingNonDefaultPort(URI uri) {
String lowerCase = StringUtils.lowerCase(uri.getScheme());
int port = uri.getPort();
if (port <= 0) {
return false;
}
if ("http".equals(lowerCase) && port == 80) {
return false;
}
return ("https".equals(lowerCase) && port == 443) ? false : true;
}
public static boolean usePayloadForQueryParameters(Request request) {
return HttpMethodName.POST.equals(request.getHttpMethod()) && (request.getContent() == null);
}
public static String encodeParameters(Request request) {
if (request.getParameters().isEmpty()) {
return null;
}
StringBuilder sb = new StringBuilder();
try {
boolean z = true;
for (Map.Entry entry : request.getParameters().entrySet()) {
String encode = URLEncoder.encode((String) entry.getKey(), "UTF-8");
String str = (String) entry.getValue();
String encode2 = str == null ? "" : URLEncoder.encode(str, "UTF-8");
if (z) {
z = false;
} else {
sb.append(v8.i.c);
}
sb.append(encode);
sb.append(v8.i.b);
sb.append(encode2);
}
return sb.toString();
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e);
}
}
public static String appendUri(String str, String str2) {
return appendUri(str, str2, false);
}
public static String appendUri(String str, String str2, boolean z) {
if (str2 != null && str2.length() > 0) {
if (str2.startsWith("/")) {
if (str.endsWith("/")) {
str = str.substring(0, str.length() - 1);
}
} else if (!str.endsWith("/")) {
str = str + "/";
}
String urlEncode = urlEncode(str2, true);
if (z) {
urlEncode = urlEncode.replace("//", "/%2F");
}
return str + urlEncode;
}
if (str.endsWith("/")) {
return str;
}
return str + "/";
}
public static String appendUriEncoded(String str, String str2) {
if (str2 == null) {
return str;
}
return str + str2;
}
}

View File

@@ -0,0 +1,70 @@
package com.amazonaws.util;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/* loaded from: classes.dex */
public enum IOUtils {
;
private static final int BUFFER_SIZE = 4096;
private static final Log logger = LogFactory.getLog(IOUtils.class);
public static byte[] toByteArray(InputStream inputStream) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
byte[] bArr = new byte[4096];
while (true) {
int read = inputStream.read(bArr);
if (read != -1) {
byteArrayOutputStream.write(bArr, 0, read);
} else {
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
return byteArray;
}
}
} catch (Throwable th) {
byteArrayOutputStream.close();
throw th;
}
}
public static String toString(InputStream inputStream) throws IOException {
return new String(toByteArray(inputStream), StringUtils.UTF8);
}
public static void closeQuietly(Closeable closeable, Log log) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
if (logger.isDebugEnabled()) {
logger.debug("Ignore failure in closing the Closeable", e);
}
}
}
}
public static void release(Closeable closeable, Log log) {
closeQuietly(closeable, log);
}
public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException {
byte[] bArr = new byte[4096];
long j = 0;
while (true) {
int read = inputStream.read(bArr);
if (read <= -1) {
return j;
}
outputStream.write(bArr, 0, read);
j += read;
}
}
}

View File

@@ -0,0 +1,119 @@
package com.amazonaws.util;
import com.amazonaws.internal.SdkFilterInputStream;
import com.ironsource.v8;
import java.io.BufferedInputStream;
import java.io.FilterInputStream;
import java.io.InputStream;
/* loaded from: classes.dex */
class NamespaceRemovingInputStream extends SdkFilterInputStream {
public boolean hasRemovedNamespace;
public final byte[] lookAheadData;
public NamespaceRemovingInputStream(InputStream inputStream) {
super(new BufferedInputStream(inputStream));
this.lookAheadData = new byte[200];
this.hasRemovedNamespace = false;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read() {
abortIfNeeded();
int read = ((FilterInputStream) this).in.read();
if (read != 120 || this.hasRemovedNamespace) {
return read;
}
this.lookAheadData[0] = (byte) read;
((FilterInputStream) this).in.mark(this.lookAheadData.length);
InputStream inputStream = ((FilterInputStream) this).in;
byte[] bArr = this.lookAheadData;
int read2 = inputStream.read(bArr, 1, bArr.length - 1);
((FilterInputStream) this).in.reset();
int matchXmlNamespaceAttribute = matchXmlNamespaceAttribute(new String(this.lookAheadData, 0, read2 + 1, StringUtils.UTF8));
if (matchXmlNamespaceAttribute <= 0) {
return read;
}
for (int i = 0; i < matchXmlNamespaceAttribute - 1; i++) {
((FilterInputStream) this).in.read();
}
int read3 = ((FilterInputStream) this).in.read();
this.hasRemovedNamespace = true;
return read3;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read(byte[] bArr, int i, int i2) {
for (int i3 = 0; i3 < i2; i3++) {
int read = read();
if (read == -1) {
if (i3 == 0) {
return -1;
}
return i3;
}
bArr[i3 + i] = (byte) read;
}
return i2;
}
@Override // java.io.FilterInputStream, java.io.InputStream
public int read(byte[] bArr) {
return read(bArr, 0, bArr.length);
}
public final int matchXmlNamespaceAttribute(String str) {
StringPrefixSlicer stringPrefixSlicer = new StringPrefixSlicer(str);
if (!stringPrefixSlicer.removePrefix("xmlns")) {
return -1;
}
stringPrefixSlicer.removeRepeatingPrefix(" ");
if (!stringPrefixSlicer.removePrefix(v8.i.b)) {
return -1;
}
stringPrefixSlicer.removeRepeatingPrefix(" ");
if (stringPrefixSlicer.removePrefix("\"") && stringPrefixSlicer.removePrefixEndingWith("\"")) {
return str.length() - stringPrefixSlicer.getString().length();
}
return -1;
}
public static final class StringPrefixSlicer {
public String s;
public String getString() {
return this.s;
}
public StringPrefixSlicer(String str) {
this.s = str;
}
public boolean removePrefix(String str) {
if (!this.s.startsWith(str)) {
return false;
}
this.s = this.s.substring(str.length());
return true;
}
public boolean removeRepeatingPrefix(String str) {
if (!this.s.startsWith(str)) {
return false;
}
while (this.s.startsWith(str)) {
this.s = this.s.substring(str.length());
}
return true;
}
public boolean removePrefixEndingWith(String str) {
int indexOf = this.s.indexOf(str);
if (indexOf < 0) {
return false;
}
this.s = this.s.substring(indexOf + str.length());
return true;
}
}
}

View File

@@ -0,0 +1,13 @@
package com.amazonaws.util;
import java.io.ByteArrayInputStream;
/* loaded from: classes.dex */
public class StringInputStream extends ByteArrayInputStream {
public final String string;
public StringInputStream(String str) {
super(str.getBytes(StringUtils.UTF8));
this.string = str;
}
}

View File

@@ -0,0 +1,43 @@
package com.amazonaws.util;
import java.nio.charset.Charset;
import java.util.Locale;
/* loaded from: classes.dex */
public abstract class StringUtils {
public static final Charset UTF8 = Charset.forName("UTF-8");
public static String fromString(String str) {
return str;
}
public static String fromInteger(Integer num) {
return Integer.toString(num.intValue());
}
public static String lowerCase(String str) {
if (str == null) {
return null;
}
return str.isEmpty() ? "" : str.toLowerCase(Locale.ENGLISH);
}
public static String upperCase(String str) {
if (str == null) {
return null;
}
return str.isEmpty() ? "" : str.toUpperCase(Locale.ENGLISH);
}
public static boolean isBlank(CharSequence charSequence) {
int length;
if (charSequence != null && (length = charSequence.length()) != 0) {
for (int i = 0; i < length; i++) {
if (!Character.isWhitespace(charSequence.charAt(i))) {
return false;
}
}
}
return true;
}
}

View File

@@ -0,0 +1,95 @@
package com.amazonaws.util;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/* loaded from: classes.dex */
public class TimingInfo {
public Long endTimeNano;
public final Long startEpochTimeMilli;
public final long startTimeNano;
public void addSubMeasurement(String str, TimingInfo timingInfo) {
}
public final long getStartTimeNano() {
return this.startTimeNano;
}
public void incrementCounter(String str) {
}
public final boolean isEndTimeKnown() {
return this.endTimeNano != null;
}
public void setCounter(String str, long j) {
}
public static TimingInfo startTiming() {
return new TimingInfo(Long.valueOf(System.currentTimeMillis()), System.nanoTime(), null);
}
public static TimingInfo startTimingFullSupport() {
return new TimingInfoFullSupport(Long.valueOf(System.currentTimeMillis()), System.nanoTime(), null);
}
public static TimingInfo startTimingFullSupport(long j) {
return new TimingInfoFullSupport(null, j, null);
}
public static TimingInfo unmodifiableTimingInfo(long j, Long l) {
return new TimingInfoUnmodifiable(null, j, l);
}
public TimingInfo(Long l, long j, Long l2) {
this.startEpochTimeMilli = l;
this.startTimeNano = j;
this.endTimeNano = l2;
}
public final long getEndTimeNano() {
Long l = this.endTimeNano;
if (l == null) {
return -1L;
}
return l.longValue();
}
public final double getTimeTakenMillis() {
Double timeTakenMillisIfKnown = getTimeTakenMillisIfKnown();
if (timeTakenMillisIfKnown == null) {
return -1.0d;
}
return timeTakenMillisIfKnown.doubleValue();
}
public final Double getTimeTakenMillisIfKnown() {
if (isEndTimeKnown()) {
return Double.valueOf(durationMilliOf(this.startTimeNano, this.endTimeNano.longValue()));
}
return null;
}
public static double durationMilliOf(long j, long j2) {
return TimeUnit.NANOSECONDS.toMicros(j2 - j) / 1000.0d;
}
public final String toString() {
return String.valueOf(getTimeTakenMillis());
}
public TimingInfo endTiming() {
this.endTimeNano = Long.valueOf(System.nanoTime());
return this;
}
public Map getSubMeasurementsByName() {
return Collections.emptyMap();
}
public Map getAllCounters() {
return Collections.emptyMap();
}
}

View File

@@ -0,0 +1,57 @@
package com.amazonaws.util;
import com.amazonaws.logging.LogFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
class TimingInfoFullSupport extends TimingInfo {
public final Map countersByName;
public final Map subMeasurementsByName;
@Override // com.amazonaws.util.TimingInfo
public Map getAllCounters() {
return this.countersByName;
}
@Override // com.amazonaws.util.TimingInfo
public Map getSubMeasurementsByName() {
return this.subMeasurementsByName;
}
public TimingInfoFullSupport(Long l, long j, Long l2) {
super(l, j, l2);
this.subMeasurementsByName = new HashMap();
this.countersByName = new HashMap();
}
@Override // com.amazonaws.util.TimingInfo
public void addSubMeasurement(String str, TimingInfo timingInfo) {
List list = (List) this.subMeasurementsByName.get(str);
if (list == null) {
list = new ArrayList();
this.subMeasurementsByName.put(str, list);
}
if (timingInfo.isEndTimeKnown()) {
list.add(timingInfo);
return;
}
LogFactory.getLog(getClass()).debug("Skip submeasurement timing info with no end time for " + str);
}
public Number getCounter(String str) {
return (Number) this.countersByName.get(str);
}
@Override // com.amazonaws.util.TimingInfo
public void setCounter(String str, long j) {
this.countersByName.put(str, Long.valueOf(j));
}
@Override // com.amazonaws.util.TimingInfo
public void incrementCounter(String str) {
setCounter(str, (getCounter(str) != null ? r0.intValue() : 0) + 1);
}
}

View File

@@ -0,0 +1,13 @@
package com.amazonaws.util;
/* loaded from: classes.dex */
final class TimingInfoUnmodifiable extends TimingInfo {
public TimingInfoUnmodifiable(Long l, long j, Long l2) {
super(l, j, l2);
}
@Override // com.amazonaws.util.TimingInfo
public TimingInfo endTiming() {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,39 @@
package com.amazonaws.util;
import com.amazonaws.Protocol;
import java.net.URI;
/* loaded from: classes.dex */
public class URIBuilder {
public static final String DEFAULT_SCHEME = Protocol.HTTPS.toString();
public String fragment;
public String host;
public String path;
public int port;
public String query;
public String scheme;
public String userInfo;
public URIBuilder host(String str) {
this.host = str;
return this;
}
public URIBuilder(URI uri) {
this.scheme = uri.getScheme();
this.userInfo = uri.getUserInfo();
this.host = uri.getHost();
this.port = uri.getPort();
this.path = uri.getPath();
this.query = uri.getQuery();
this.fragment = uri.getFragment();
}
public static URIBuilder builder(URI uri) {
return new URIBuilder(uri);
}
public URI build() {
return new URI(this.scheme, this.userInfo, this.host, this.port, this.path, this.query, this.fragment);
}
}

View File

@@ -0,0 +1,69 @@
package com.amazonaws.util;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
/* loaded from: classes.dex */
public abstract class VersionInfoUtils {
public static final Log log = LogFactory.getLog(VersionInfoUtils.class);
public static volatile String platform = "android";
public static volatile String userAgent = null;
public static volatile String version = "2.22.6";
public static String getPlatform() {
return platform;
}
public static String getVersion() {
return version;
}
public static String getUserAgent() {
if (userAgent == null) {
synchronized (VersionInfoUtils.class) {
try {
if (userAgent == null) {
initializeUserAgent();
}
} finally {
}
}
}
return userAgent;
}
public static void initializeUserAgent() {
userAgent = userAgent();
}
public static String userAgent() {
StringBuilder sb = new StringBuilder(128);
sb.append("aws-sdk-");
sb.append(StringUtils.lowerCase(getPlatform()));
sb.append("/");
sb.append(getVersion());
sb.append(" ");
sb.append(replaceSpaces(System.getProperty("os.name")));
sb.append("/");
sb.append(replaceSpaces(System.getProperty("os.version")));
sb.append(" ");
sb.append(replaceSpaces(System.getProperty("java.vm.name")));
sb.append("/");
sb.append(replaceSpaces(System.getProperty("java.vm.version")));
sb.append("/");
sb.append(replaceSpaces(System.getProperty("java.version")));
String property = System.getProperty("user.language");
String property2 = System.getProperty("user.region");
if (property != null && property2 != null) {
sb.append(" ");
sb.append(replaceSpaces(property));
sb.append("_");
sb.append(replaceSpaces(property2));
}
return sb.toString();
}
public static String replaceSpaces(String str) {
return str != null ? str.replace(' ', '_') : str;
}
}

View File

@@ -0,0 +1,72 @@
package com.amazonaws.util;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import csdk.gluads.Consts;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
/* loaded from: classes.dex */
public abstract class XpathUtils {
public static Log log = LogFactory.getLog(XpathUtils.class);
public static DocumentBuilderFactory factory = getDocumentBuilderFactory();
public static boolean isEmpty(Node node) {
return node == null;
}
public static DocumentBuilderFactory getDocumentBuilderFactory() {
try {
DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
newInstance.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
newInstance.setXIncludeAware(false);
newInstance.setExpandEntityReferences(false);
return newInstance;
} catch (ParserConfigurationException unused) {
return null;
}
}
public static Document documentFrom(InputStream inputStream) {
NamespaceRemovingInputStream namespaceRemovingInputStream = new NamespaceRemovingInputStream(inputStream);
Document parse = factory.newDocumentBuilder().parse(namespaceRemovingInputStream);
namespaceRemovingInputStream.close();
return parse;
}
public static Document documentFrom(String str) {
return documentFrom(new ByteArrayInputStream(str.getBytes(StringUtils.UTF8)));
}
public static String asString(String str, Node node) {
return evaluateAsString(str, node);
}
public static String evaluateAsString(String str, Node node) {
if (isEmpty(node)) {
return null;
}
if (Consts.STRING_PERIOD.equals(str) || asNode(str, node) != null) {
return xpath().evaluate(str, node).trim();
}
return null;
}
public static Node asNode(String str, Node node) {
if (node == null) {
return null;
}
return (Node) xpath().evaluate(str, node, XPathConstants.NODE);
}
public static XPath xpath() {
return XPathFactory.newInstance().newXPath();
}
}

View File

@@ -0,0 +1,11 @@
package com.amazonaws.util.json;
import java.io.Reader;
import java.io.Writer;
/* loaded from: classes.dex */
public interface AwsJsonFactory {
AwsJsonReader getJsonReader(Reader reader);
AwsJsonWriter getJsonWriter(Writer writer);
}

View File

@@ -0,0 +1,26 @@
package com.amazonaws.util.json;
/* loaded from: classes.dex */
public interface AwsJsonReader {
void beginArray();
void beginObject();
void close();
void endArray();
void endObject();
boolean hasNext();
boolean isContainer();
String nextName();
String nextString();
AwsJsonToken peek();
void skipValue();
}

View File

@@ -0,0 +1,15 @@
package com.amazonaws.util.json;
/* loaded from: classes.dex */
public enum AwsJsonToken {
BEGIN_ARRAY,
END_ARRAY,
BEGIN_OBJECT,
END_OBJECT,
FIELD_NAME,
VALUE_BOOLEAN,
VALUE_NULL,
VALUE_NUMBER,
VALUE_STRING,
UNKNOWN
}

View File

@@ -0,0 +1,24 @@
package com.amazonaws.util.json;
import java.nio.ByteBuffer;
/* loaded from: classes.dex */
public interface AwsJsonWriter {
AwsJsonWriter beginArray();
AwsJsonWriter beginObject();
void close();
AwsJsonWriter endArray();
AwsJsonWriter endObject();
void flush();
AwsJsonWriter name(String str);
AwsJsonWriter value(String str);
AwsJsonWriter value(ByteBuffer byteBuffer);
}

View File

@@ -0,0 +1,51 @@
package com.amazonaws.util.json;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/* loaded from: classes.dex */
public class DateDeserializer implements JsonDeserializer<Date>, JsonSerializer<Date> {
public final List dateFormats;
public final SimpleDateFormat mIso8601DateFormat;
public SimpleDateFormat mSimpleDateFormat;
@Override // com.google.gson.JsonDeserializer
public Date deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
String asString = jsonElement.getAsString();
for (String str : this.dateFormats) {
try {
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str);
this.mSimpleDateFormat = simpleDateFormat;
date.setTime(simpleDateFormat.parse(asString).getTime());
return date;
} catch (ParseException unused) {
}
}
try {
return DateFormat.getDateInstance(2).parse(asString);
} catch (ParseException e) {
throw new JsonParseException(e.getMessage(), e);
}
}
@Override // com.google.gson.JsonSerializer
public JsonElement serialize(Date date, Type type, JsonSerializationContext jsonSerializationContext) {
JsonPrimitive jsonPrimitive;
synchronized (this.mIso8601DateFormat) {
jsonPrimitive = new JsonPrimitive(this.mIso8601DateFormat.format(date));
}
return jsonPrimitive;
}
}

View File

@@ -0,0 +1,244 @@
package com.amazonaws.util.json;
import com.amazonaws.util.BinaryUtils;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.EOFException;
import java.io.Reader;
import java.io.Writer;
import java.nio.ByteBuffer;
/* loaded from: classes.dex */
final class GsonFactory implements AwsJsonFactory {
@Override // com.amazonaws.util.json.AwsJsonFactory
public AwsJsonReader getJsonReader(Reader reader) {
return new GsonReader(reader);
}
@Override // com.amazonaws.util.json.AwsJsonFactory
public AwsJsonWriter getJsonWriter(Writer writer) {
return new GsonWriter(writer);
}
public static final class GsonReader implements AwsJsonReader {
public final JsonReader reader;
public GsonReader(Reader reader) {
this.reader = new JsonReader(reader);
}
@Override // com.amazonaws.util.json.AwsJsonReader
public void beginArray() {
this.reader.beginArray();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public void endArray() {
this.reader.endArray();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public void beginObject() {
this.reader.beginObject();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public void endObject() {
this.reader.endObject();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public boolean isContainer() {
JsonToken peek = this.reader.peek();
return JsonToken.BEGIN_ARRAY.equals(peek) || JsonToken.BEGIN_OBJECT.equals(peek);
}
@Override // com.amazonaws.util.json.AwsJsonReader
public boolean hasNext() {
return this.reader.hasNext();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public String nextName() {
return this.reader.nextName();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public String nextString() {
JsonToken peek = this.reader.peek();
if (JsonToken.NULL.equals(peek)) {
this.reader.nextNull();
return null;
}
if (JsonToken.BOOLEAN.equals(peek)) {
return this.reader.nextBoolean() ? "true" : "false";
}
return this.reader.nextString();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public void skipValue() {
this.reader.skipValue();
}
@Override // com.amazonaws.util.json.AwsJsonReader
public AwsJsonToken peek() {
try {
return GsonFactory.convert(this.reader.peek());
} catch (EOFException unused) {
return null;
}
}
@Override // com.amazonaws.util.json.AwsJsonReader
public void close() {
this.reader.close();
}
}
/* renamed from: com.amazonaws.util.json.GsonFactory$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
public static final /* synthetic */ int[] $SwitchMap$com$google$gson$stream$JsonToken;
static {
int[] iArr = new int[JsonToken.values().length];
$SwitchMap$com$google$gson$stream$JsonToken = iArr;
try {
iArr[JsonToken.BEGIN_ARRAY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.END_ARRAY.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.BEGIN_OBJECT.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.END_OBJECT.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.NAME.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.BOOLEAN.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.NUMBER.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.NULL.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.STRING.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.END_DOCUMENT.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
}
}
public static AwsJsonToken convert(JsonToken jsonToken) {
if (jsonToken == null) {
return null;
}
switch (AnonymousClass1.$SwitchMap$com$google$gson$stream$JsonToken[jsonToken.ordinal()]) {
case 1:
return AwsJsonToken.BEGIN_ARRAY;
case 2:
return AwsJsonToken.END_ARRAY;
case 3:
return AwsJsonToken.BEGIN_OBJECT;
case 4:
return AwsJsonToken.END_OBJECT;
case 5:
return AwsJsonToken.FIELD_NAME;
case 6:
return AwsJsonToken.VALUE_BOOLEAN;
case 7:
return AwsJsonToken.VALUE_NUMBER;
case 8:
return AwsJsonToken.VALUE_NULL;
case 9:
return AwsJsonToken.VALUE_STRING;
case 10:
return null;
default:
return AwsJsonToken.UNKNOWN;
}
}
public static final class GsonWriter implements AwsJsonWriter {
public final JsonWriter writer;
public GsonWriter(Writer writer) {
this.writer = new JsonWriter(writer);
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public AwsJsonWriter beginArray() {
this.writer.beginArray();
return this;
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public AwsJsonWriter endArray() {
this.writer.endArray();
return this;
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public AwsJsonWriter beginObject() {
this.writer.beginObject();
return this;
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public AwsJsonWriter endObject() {
this.writer.endObject();
return this;
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public AwsJsonWriter name(String str) {
this.writer.name(str);
return this;
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public AwsJsonWriter value(String str) {
this.writer.value(str);
return this;
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public AwsJsonWriter value(ByteBuffer byteBuffer) {
byteBuffer.mark();
int remaining = byteBuffer.remaining();
byte[] bArr = new byte[remaining];
byteBuffer.get(bArr, 0, remaining);
byteBuffer.reset();
this.writer.value(BinaryUtils.toBase64(bArr));
return this;
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public void flush() {
this.writer.flush();
}
@Override // com.amazonaws.util.json.AwsJsonWriter
public void close() {
this.writer.close();
}
}
}

View File

@@ -0,0 +1,90 @@
package com.amazonaws.util.json;
import com.amazonaws.AmazonClientException;
import java.io.IOException;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class JsonUtils {
public static final AwsJsonFactory FACTORY = new GsonFactory();
public static AwsJsonReader getJsonReader(Reader reader) {
return FACTORY.getJsonReader(reader);
}
public static AwsJsonWriter getJsonWriter(Writer writer) {
return FACTORY.getJsonWriter(writer);
}
public static Map jsonToStringMapWithList(Reader reader) {
AwsJsonReader jsonReader = getJsonReader(reader);
try {
if (jsonReader.peek() == null) {
return Collections.EMPTY_MAP;
}
HashMap hashMap = new HashMap();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (jsonReader.isContainer()) {
if (AwsJsonToken.BEGIN_ARRAY.equals(jsonReader.peek())) {
StringWriter stringWriter = new StringWriter();
AwsJsonWriter jsonWriter = getJsonWriter(stringWriter);
jsonReader.beginArray();
jsonWriter.beginArray();
while (true) {
try {
AwsJsonToken awsJsonToken = AwsJsonToken.END_ARRAY;
if (awsJsonToken.equals(jsonReader.peek())) {
break;
}
AwsJsonToken peek = jsonReader.peek();
if (AwsJsonToken.BEGIN_OBJECT.equals(peek)) {
jsonReader.beginObject();
jsonWriter.beginObject();
} else if (AwsJsonToken.FIELD_NAME.equals(peek)) {
String nextName2 = jsonReader.nextName();
if (!AwsJsonToken.BEGIN_ARRAY.equals(jsonReader.peek())) {
jsonWriter.name(nextName2);
}
} else if (AwsJsonToken.END_OBJECT.equals(peek)) {
jsonReader.endObject();
jsonWriter.endObject();
} else if (awsJsonToken.equals(peek)) {
jsonReader.endArray();
jsonWriter.endArray();
} else {
if (!AwsJsonToken.VALUE_STRING.equals(peek) && !AwsJsonToken.VALUE_NUMBER.equals(peek) && !AwsJsonToken.VALUE_NULL.equals(peek) && !AwsJsonToken.VALUE_BOOLEAN.equals(peek)) {
jsonReader.skipValue();
}
jsonWriter.value(jsonReader.nextString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
jsonReader.endArray();
jsonWriter.endArray();
jsonWriter.flush();
jsonWriter.close();
hashMap.put(nextName, stringWriter.toString());
} else {
jsonReader.skipValue();
}
} else {
hashMap.put(nextName, jsonReader.nextString());
}
}
jsonReader.endObject();
jsonReader.close();
return Collections.unmodifiableMap(hashMap);
} catch (IOException e2) {
throw new AmazonClientException("Unable to parse JSON String.", e2);
}
}
}