366 lines
8.7 KiB
Java
366 lines
8.7 KiB
Java
package c.i.a.c.i2;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import c.d.b.a.a;
|
|
import c.i.b.a.c;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import java.nio.charset.Charset;
|
|
import java.util.Arrays;
|
|
/* compiled from: ParsableByteArray */
|
|
public final class w {
|
|
public byte[] a;
|
|
public int b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public int f913c;
|
|
|
|
public w() {
|
|
this.a = f0.f;
|
|
}
|
|
|
|
public w(int i) {
|
|
this.a = new byte[i];
|
|
this.f913c = i;
|
|
}
|
|
|
|
public w(byte[] bArr) {
|
|
this.a = bArr;
|
|
this.f913c = bArr.length;
|
|
}
|
|
|
|
public w(byte[] bArr, int i) {
|
|
this.a = bArr;
|
|
this.f913c = i;
|
|
}
|
|
|
|
public void A(byte[] bArr) {
|
|
int length = bArr.length;
|
|
this.a = bArr;
|
|
this.f913c = length;
|
|
this.b = 0;
|
|
}
|
|
|
|
public void B(byte[] bArr, int i) {
|
|
this.a = bArr;
|
|
this.f913c = i;
|
|
this.b = 0;
|
|
}
|
|
|
|
public void C(int i) {
|
|
AnimatableValueParser.k(i >= 0 && i <= this.a.length);
|
|
this.f913c = i;
|
|
}
|
|
|
|
public void D(int i) {
|
|
AnimatableValueParser.k(i >= 0 && i <= this.f913c);
|
|
this.b = i;
|
|
}
|
|
|
|
public void E(int i) {
|
|
D(this.b + i);
|
|
}
|
|
|
|
public int a() {
|
|
return this.f913c - this.b;
|
|
}
|
|
|
|
public void b(int i) {
|
|
byte[] bArr = this.a;
|
|
if (i > bArr.length) {
|
|
this.a = Arrays.copyOf(bArr, i);
|
|
}
|
|
}
|
|
|
|
public int c() {
|
|
return this.a[this.b] & 255;
|
|
}
|
|
|
|
public void d(v vVar, int i) {
|
|
e(vVar.a, 0, i);
|
|
vVar.k(0);
|
|
}
|
|
|
|
public void e(byte[] bArr, int i, int i2) {
|
|
System.arraycopy(this.a, this.b, bArr, i, i2);
|
|
this.b += i2;
|
|
}
|
|
|
|
public int f() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
int i3 = i2 + 1;
|
|
this.b = i3;
|
|
int i4 = ((bArr[i] & 255) << 24) | ((bArr[i2] & 255) << 16);
|
|
int i5 = i3 + 1;
|
|
this.b = i5;
|
|
int i6 = i4 | ((bArr[i3] & 255) << 8);
|
|
this.b = i5 + 1;
|
|
return (bArr[i5] & 255) | i6;
|
|
}
|
|
|
|
@Nullable
|
|
public String g() {
|
|
if (a() == 0) {
|
|
return null;
|
|
}
|
|
int i = this.b;
|
|
while (i < this.f913c) {
|
|
byte b = this.a[i];
|
|
int i2 = f0.a;
|
|
if (b == 10 || b == 13) {
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
int i3 = this.b;
|
|
if (i - i3 >= 3) {
|
|
byte[] bArr = this.a;
|
|
if (bArr[i3] == -17 && bArr[i3 + 1] == -69 && bArr[i3 + 2] == -65) {
|
|
this.b = i3 + 3;
|
|
}
|
|
}
|
|
byte[] bArr2 = this.a;
|
|
int i4 = this.b;
|
|
String m = f0.m(bArr2, i4, i - i4);
|
|
this.b = i;
|
|
int i5 = this.f913c;
|
|
if (i == i5) {
|
|
return m;
|
|
}
|
|
byte[] bArr3 = this.a;
|
|
if (bArr3[i] == 13) {
|
|
int i6 = i + 1;
|
|
this.b = i6;
|
|
if (i6 == i5) {
|
|
return m;
|
|
}
|
|
}
|
|
int i7 = this.b;
|
|
if (bArr3[i7] == 10) {
|
|
this.b = i7 + 1;
|
|
}
|
|
return m;
|
|
}
|
|
|
|
public int h() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
int i3 = i2 + 1;
|
|
this.b = i3;
|
|
int i4 = (bArr[i] & 255) | ((bArr[i2] & 255) << 8);
|
|
int i5 = i3 + 1;
|
|
this.b = i5;
|
|
int i6 = i4 | ((bArr[i3] & 255) << 16);
|
|
this.b = i5 + 1;
|
|
return ((bArr[i5] & 255) << 24) | i6;
|
|
}
|
|
|
|
public short i() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
this.b = i2 + 1;
|
|
return (short) (((bArr[i2] & 255) << 8) | (bArr[i] & 255));
|
|
}
|
|
|
|
public long j() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
int i3 = i2 + 1;
|
|
this.b = i3;
|
|
int i4 = i3 + 1;
|
|
this.b = i4;
|
|
this.b = i4 + 1;
|
|
return (((long) bArr[i]) & 255) | ((((long) bArr[i2]) & 255) << 8) | ((((long) bArr[i3]) & 255) << 16) | ((((long) bArr[i4]) & 255) << 24);
|
|
}
|
|
|
|
public int k() {
|
|
int h = h();
|
|
if (h >= 0) {
|
|
return h;
|
|
}
|
|
throw new IllegalStateException(a.j("Top bit not zero: ", h));
|
|
}
|
|
|
|
public int l() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
this.b = i2 + 1;
|
|
return ((bArr[i2] & 255) << 8) | (bArr[i] & 255);
|
|
}
|
|
|
|
public long m() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
int i3 = i2 + 1;
|
|
this.b = i3;
|
|
int i4 = i3 + 1;
|
|
this.b = i4;
|
|
int i5 = i4 + 1;
|
|
this.b = i5;
|
|
int i6 = i5 + 1;
|
|
this.b = i6;
|
|
int i7 = i6 + 1;
|
|
this.b = i7;
|
|
int i8 = i7 + 1;
|
|
this.b = i8;
|
|
this.b = i8 + 1;
|
|
return ((((long) bArr[i]) & 255) << 56) | ((((long) bArr[i2]) & 255) << 48) | ((((long) bArr[i3]) & 255) << 40) | ((((long) bArr[i4]) & 255) << 32) | ((((long) bArr[i5]) & 255) << 24) | ((((long) bArr[i6]) & 255) << 16) | ((((long) bArr[i7]) & 255) << 8) | (((long) bArr[i8]) & 255);
|
|
}
|
|
|
|
@Nullable
|
|
public String n() {
|
|
if (a() == 0) {
|
|
return null;
|
|
}
|
|
int i = this.b;
|
|
while (i < this.f913c && this.a[i] != 0) {
|
|
i++;
|
|
}
|
|
byte[] bArr = this.a;
|
|
int i2 = this.b;
|
|
String m = f0.m(bArr, i2, i - i2);
|
|
this.b = i;
|
|
if (i < this.f913c) {
|
|
this.b = i + 1;
|
|
}
|
|
return m;
|
|
}
|
|
|
|
public String o(int i) {
|
|
if (i == 0) {
|
|
return "";
|
|
}
|
|
int i2 = this.b;
|
|
int i3 = (i2 + i) - 1;
|
|
String m = f0.m(this.a, i2, (i3 >= this.f913c || this.a[i3] != 0) ? i : i - 1);
|
|
this.b += i;
|
|
return m;
|
|
}
|
|
|
|
public String p(int i) {
|
|
return q(i, c.f1266c);
|
|
}
|
|
|
|
public String q(int i, Charset charset) {
|
|
String str = new String(this.a, this.b, i, charset);
|
|
this.b += i;
|
|
return str;
|
|
}
|
|
|
|
public int r() {
|
|
return (s() << 21) | (s() << 14) | (s() << 7) | s();
|
|
}
|
|
|
|
public int s() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
this.b = i + 1;
|
|
return bArr[i] & 255;
|
|
}
|
|
|
|
public long t() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
int i3 = i2 + 1;
|
|
this.b = i3;
|
|
int i4 = i3 + 1;
|
|
this.b = i4;
|
|
this.b = i4 + 1;
|
|
return ((((long) bArr[i]) & 255) << 24) | ((((long) bArr[i2]) & 255) << 16) | ((((long) bArr[i3]) & 255) << 8) | (((long) bArr[i4]) & 255);
|
|
}
|
|
|
|
public int u() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
int i3 = i2 + 1;
|
|
this.b = i3;
|
|
int i4 = ((bArr[i] & 255) << 16) | ((bArr[i2] & 255) << 8);
|
|
this.b = i3 + 1;
|
|
return (bArr[i3] & 255) | i4;
|
|
}
|
|
|
|
public int v() {
|
|
int f = f();
|
|
if (f >= 0) {
|
|
return f;
|
|
}
|
|
throw new IllegalStateException(a.j("Top bit not zero: ", f));
|
|
}
|
|
|
|
public long w() {
|
|
long m = m();
|
|
if (m >= 0) {
|
|
return m;
|
|
}
|
|
throw new IllegalStateException(a.o("Top bit not zero: ", m));
|
|
}
|
|
|
|
public int x() {
|
|
byte[] bArr = this.a;
|
|
int i = this.b;
|
|
int i2 = i + 1;
|
|
this.b = i2;
|
|
this.b = i2 + 1;
|
|
return (bArr[i2] & 255) | ((bArr[i] & 255) << 8);
|
|
}
|
|
|
|
public long y() {
|
|
int i;
|
|
int i2;
|
|
long j = (long) this.a[this.b];
|
|
int i3 = 7;
|
|
while (true) {
|
|
if (i3 < 0) {
|
|
break;
|
|
}
|
|
int i4 = 1 << i3;
|
|
if ((((long) i4) & j) != 0) {
|
|
i3--;
|
|
} else if (i3 < 6) {
|
|
j &= (long) (i4 - 1);
|
|
i2 = 7 - i3;
|
|
} else if (i3 == 7) {
|
|
i2 = 1;
|
|
}
|
|
}
|
|
i2 = 0;
|
|
if (i2 != 0) {
|
|
for (i = 1; i < i2; i++) {
|
|
byte b = this.a[this.b + i];
|
|
if ((b & 192) == 128) {
|
|
j = (j << 6) | ((long) (b & 63));
|
|
} else {
|
|
throw new NumberFormatException(a.o("Invalid UTF-8 sequence continuation byte: ", j));
|
|
}
|
|
}
|
|
this.b += i2;
|
|
return j;
|
|
}
|
|
throw new NumberFormatException(a.o("Invalid UTF-8 sequence first byte: ", j));
|
|
}
|
|
|
|
public void z(int i) {
|
|
byte[] bArr = this.a;
|
|
if (bArr.length < i) {
|
|
bArr = new byte[i];
|
|
}
|
|
B(bArr, i);
|
|
}
|
|
}
|