192 lines
6.0 KiB
Java
192 lines
6.0 KiB
Java
|
package com.airbnb.lottie.parser.moshi;
|
||
|
|
||
|
import java.io.Closeable;
|
||
|
import java.io.IOException;
|
||
|
import java.util.Arrays;
|
||
|
import o.C15111ghZ;
|
||
|
import o.C15155gij;
|
||
|
import o.C15163gir;
|
||
|
import o.InterfaceC15149gid;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public abstract class JsonReader implements Closeable {
|
||
|
private static final String[] REPLACEMENT_CHARS = new String[128];
|
||
|
boolean failOnUnknown;
|
||
|
boolean lenient;
|
||
|
int stackSize;
|
||
|
int[] scopes = new int[32];
|
||
|
String[] pathNames = new String[32];
|
||
|
int[] pathIndices = new int[32];
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public enum Token {
|
||
|
BEGIN_ARRAY,
|
||
|
END_ARRAY,
|
||
|
BEGIN_OBJECT,
|
||
|
END_OBJECT,
|
||
|
NAME,
|
||
|
STRING,
|
||
|
NUMBER,
|
||
|
BOOLEAN,
|
||
|
NULL,
|
||
|
END_DOCUMENT
|
||
|
}
|
||
|
|
||
|
public abstract void beginArray() throws IOException;
|
||
|
|
||
|
public abstract void beginObject() throws IOException;
|
||
|
|
||
|
public abstract void endArray() throws IOException;
|
||
|
|
||
|
public abstract void endObject() throws IOException;
|
||
|
|
||
|
public abstract boolean hasNext() throws IOException;
|
||
|
|
||
|
public abstract boolean nextBoolean() throws IOException;
|
||
|
|
||
|
public abstract double nextDouble() throws IOException;
|
||
|
|
||
|
public abstract int nextInt() throws IOException;
|
||
|
|
||
|
public abstract String nextName() throws IOException;
|
||
|
|
||
|
public abstract String nextString() throws IOException;
|
||
|
|
||
|
public abstract Token peek() throws IOException;
|
||
|
|
||
|
public abstract int selectName(Options options) throws IOException;
|
||
|
|
||
|
public abstract void skipName() throws IOException;
|
||
|
|
||
|
public abstract void skipValue() throws IOException;
|
||
|
|
||
|
static {
|
||
|
for (int i = 0; i <= 31; i++) {
|
||
|
REPLACEMENT_CHARS[i] = String.format("\\u%04x", Integer.valueOf(i));
|
||
|
}
|
||
|
String[] strArr = REPLACEMENT_CHARS;
|
||
|
strArr[34] = "\\\"";
|
||
|
strArr[92] = "\\\\";
|
||
|
strArr[9] = "\\t";
|
||
|
strArr[8] = "\\b";
|
||
|
strArr[10] = "\\n";
|
||
|
strArr[13] = "\\r";
|
||
|
strArr[12] = "\\f";
|
||
|
}
|
||
|
|
||
|
public static JsonReader of(InterfaceC15149gid interfaceC15149gid) {
|
||
|
return new JsonUtf8Reader(interfaceC15149gid);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final void pushScope(int i) {
|
||
|
int i2 = this.stackSize;
|
||
|
int[] iArr = this.scopes;
|
||
|
if (i2 == iArr.length) {
|
||
|
if (i2 == 256) {
|
||
|
StringBuilder sb = new StringBuilder("Nesting too deep at ");
|
||
|
sb.append(getPath());
|
||
|
throw new JsonDataException(sb.toString());
|
||
|
}
|
||
|
this.scopes = Arrays.copyOf(iArr, iArr.length << 1);
|
||
|
String[] strArr = this.pathNames;
|
||
|
this.pathNames = (String[]) Arrays.copyOf(strArr, strArr.length << 1);
|
||
|
int[] iArr2 = this.pathIndices;
|
||
|
this.pathIndices = Arrays.copyOf(iArr2, iArr2.length << 1);
|
||
|
}
|
||
|
int[] iArr3 = this.scopes;
|
||
|
int i3 = this.stackSize;
|
||
|
this.stackSize = i3 + 1;
|
||
|
iArr3[i3] = i;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final JsonEncodingException syntaxError(String str) throws JsonEncodingException {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(str);
|
||
|
sb.append(" at path ");
|
||
|
sb.append(getPath());
|
||
|
throw new JsonEncodingException(sb.toString());
|
||
|
}
|
||
|
|
||
|
public final String getPath() {
|
||
|
return JsonScope.getPath(this.stackSize, this.scopes, this.pathNames, this.pathIndices);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class Options {
|
||
|
final C15163gir doubleQuoteSuffix;
|
||
|
final String[] strings;
|
||
|
|
||
|
private Options(String[] strArr, C15163gir c15163gir) {
|
||
|
this.strings = strArr;
|
||
|
this.doubleQuoteSuffix = c15163gir;
|
||
|
}
|
||
|
|
||
|
public static Options of(String... strArr) {
|
||
|
try {
|
||
|
C15155gij[] c15155gijArr = new C15155gij[strArr.length];
|
||
|
C15111ghZ c15111ghZ = new C15111ghZ();
|
||
|
for (int i = 0; i < strArr.length; i++) {
|
||
|
JsonReader.string(c15111ghZ, strArr[i]);
|
||
|
c15111ghZ.f();
|
||
|
c15155gijArr[i] = c15111ghZ.c(c15111ghZ.c);
|
||
|
}
|
||
|
return new Options((String[]) strArr.clone(), C15163gir.b(c15155gijArr));
|
||
|
} catch (IOException e) {
|
||
|
throw new AssertionError(e);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:8:0x002b */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public static void string(o.InterfaceC15148gic r7, java.lang.String r8) throws java.io.IOException {
|
||
|
/*
|
||
|
java.lang.String[] r0 = com.airbnb.lottie.parser.moshi.JsonReader.REPLACEMENT_CHARS
|
||
|
r1 = 34
|
||
|
r7.b(r1)
|
||
|
int r2 = r8.length()
|
||
|
r3 = 0
|
||
|
r4 = r3
|
||
|
Ld:
|
||
|
if (r3 >= r2) goto L36
|
||
|
char r5 = r8.charAt(r3)
|
||
|
r6 = 128(0x80, float:1.8E-43)
|
||
|
if (r5 >= r6) goto L1c
|
||
|
r5 = r0[r5]
|
||
|
if (r5 != 0) goto L29
|
||
|
goto L33
|
||
|
L1c:
|
||
|
r6 = 8232(0x2028, float:1.1535E-41)
|
||
|
if (r5 != r6) goto L23
|
||
|
java.lang.String r5 = "\\u2028"
|
||
|
goto L29
|
||
|
L23:
|
||
|
r6 = 8233(0x2029, float:1.1537E-41)
|
||
|
if (r5 != r6) goto L33
|
||
|
java.lang.String r5 = "\\u2029"
|
||
|
L29:
|
||
|
if (r4 >= r3) goto L2e
|
||
|
r7.c(r8, r4, r3)
|
||
|
L2e:
|
||
|
r7.d(r5)
|
||
|
int r4 = r3 + 1
|
||
|
L33:
|
||
|
int r3 = r3 + 1
|
||
|
goto Ld
|
||
|
L36:
|
||
|
if (r4 >= r2) goto L3b
|
||
|
r7.c(r8, r4, r2)
|
||
|
L3b:
|
||
|
r7.b(r1)
|
||
|
return
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.airbnb.lottie.parser.moshi.JsonReader.string(o.gic, java.lang.String):void");
|
||
|
}
|
||
|
}
|