jimu-decompiled/sources/com/google/android/gms/internal/measurement/zzxz.java
2025-05-13 19:24:51 +02:00

306 lines
7.6 KiB
Java

package com.google.android.gms.internal.measurement;
import java.io.IOException;
/* loaded from: classes.dex */
public final class zzxz {
private final byte[] a;
private final int b;
private final int c;
private int d;
private int e;
private int f;
private int g;
private int i;
private zztq k;
private int h = Integer.MAX_VALUE;
private int j = 64;
private zzxz(byte[] bArr, int i, int i2) {
this.a = bArr;
this.b = i;
int i3 = i2 + i;
this.d = i3;
this.c = i3;
this.f = i;
}
public static zzxz a(byte[] bArr, int i, int i2) {
return new zzxz(bArr, 0, i2);
}
private final void j() {
this.d += this.e;
int i = this.d;
int i2 = this.h;
if (i <= i2) {
this.e = 0;
} else {
this.e = i - i2;
this.d = i - this.e;
}
}
private final byte k() throws IOException {
int i = this.f;
if (i == this.d) {
throw zzyh.zzzd();
}
byte[] bArr = this.a;
this.f = i + 1;
return bArr[i];
}
private final zztq l() throws IOException {
if (this.k == null) {
this.k = zztq.a(this.a, this.b, this.c);
}
int t = this.k.t();
int i = this.f - this.b;
if (t > i) {
throw new IOException(String.format("CodedInputStream read ahead of CodedInputByteBufferNano: %s > %s", Integer.valueOf(t), Integer.valueOf(i)));
}
this.k.f(i - t);
this.k.c(this.j - this.i);
return this.k;
}
public final boolean b(int i) throws IOException {
int c;
int i2 = i & 7;
if (i2 == 0) {
e();
return true;
}
if (i2 == 1) {
h();
return true;
}
if (i2 == 2) {
f(e());
return true;
}
if (i2 != 3) {
if (i2 == 4) {
return false;
}
if (i2 != 5) {
throw new zzyh("Protocol message tag had invalid wire type.");
}
g();
return true;
}
do {
c = c();
if (c == 0) {
break;
}
} while (b(c));
a(((i >>> 3) << 3) | 4);
return true;
}
public final int c() throws IOException {
if (this.f == this.d) {
this.g = 0;
return 0;
}
this.g = e();
int i = this.g;
if (i != 0) {
return i;
}
throw new zzyh("Protocol message contained an invalid tag (zero).");
}
public final boolean d() throws IOException {
return e() != 0;
}
public final int e() throws IOException {
int i;
byte k = k();
if (k >= 0) {
return k;
}
int i2 = k & Byte.MAX_VALUE;
byte k2 = k();
if (k2 >= 0) {
i = k2 << 7;
} else {
i2 |= (k2 & Byte.MAX_VALUE) << 7;
byte k3 = k();
if (k3 >= 0) {
i = k3 << 14;
} else {
i2 |= (k3 & Byte.MAX_VALUE) << 14;
byte k4 = k();
if (k4 < 0) {
int i3 = i2 | ((k4 & Byte.MAX_VALUE) << 21);
byte k5 = k();
int i4 = i3 | (k5 << 28);
if (k5 >= 0) {
return i4;
}
for (int i5 = 0; i5 < 5; i5++) {
if (k() >= 0) {
return i4;
}
}
throw zzyh.zzzf();
}
i = k4 << 21;
}
}
return i2 | i;
}
public final long f() throws IOException {
long j = 0;
for (int i = 0; i < 64; i += 7) {
j |= (r3 & Byte.MAX_VALUE) << i;
if ((k() & 128) == 0) {
return j;
}
}
throw zzyh.zzzf();
}
public final int g() throws IOException {
return (k() & 255) | ((k() & 255) << 8) | ((k() & 255) << 16) | ((k() & 255) << 24);
}
public final long h() throws IOException {
return ((k() & 255) << 8) | (k() & 255) | ((k() & 255) << 16) | ((k() & 255) << 24) | ((k() & 255) << 32) | ((k() & 255) << 40) | ((k() & 255) << 48) | ((k() & 255) << 56);
}
public final int i() {
int i = this.h;
if (i == Integer.MAX_VALUE) {
return -1;
}
return i - this.f;
}
public final void a(int i) throws zzyh {
if (this.g != i) {
throw new zzyh("Protocol message end-group tag did not match expected tag.");
}
}
public final void d(int i) {
this.h = i;
j();
}
private final void f(int i) throws IOException {
if (i >= 0) {
int i2 = this.f;
int i3 = i2 + i;
int i4 = this.h;
if (i3 <= i4) {
if (i <= this.d - i2) {
this.f = i2 + i;
return;
}
throw zzyh.zzzd();
}
f(i4 - i2);
throw zzyh.zzzd();
}
throw zzyh.zzze();
}
public final void a(zzyi zzyiVar) throws IOException {
int e = e();
if (this.i < this.j) {
int c = c(e);
this.i++;
zzyiVar.a(this);
a(0);
this.i--;
d(c);
return;
}
throw zzyh.zzzg();
}
public final int c(int i) throws zzyh {
if (i >= 0) {
int i2 = i + this.f;
int i3 = this.h;
if (i2 <= i3) {
this.h = i2;
j();
return i3;
}
throw zzyh.zzzd();
}
throw zzyh.zzze();
}
public final void e(int i) {
b(i, this.g);
}
public final String b() throws IOException {
int e = e();
if (e >= 0) {
int i = this.d;
int i2 = this.f;
if (e <= i - i2) {
String str = new String(this.a, i2, e, zzyg.a);
this.f += e;
return str;
}
throw zzyh.zzzd();
}
throw zzyh.zzze();
}
public final <T extends zzuo<T, ?>> T a(zzwf<T> zzwfVar) throws IOException {
try {
T t = (T) l().a(zzwfVar, zzub.d());
b(this.g);
return t;
} catch (zzuv e) {
throw new zzyh("", e);
}
}
final void b(int i, int i2) {
int i3 = this.f;
int i4 = this.b;
if (i > i3 - i4) {
StringBuilder sb = new StringBuilder(50);
sb.append("Position ");
sb.append(i);
sb.append(" is beyond current ");
sb.append(i3 - i4);
throw new IllegalArgumentException(sb.toString());
}
if (i >= 0) {
this.f = i4 + i;
this.g = i2;
} else {
StringBuilder sb2 = new StringBuilder(24);
sb2.append("Bad position ");
sb2.append(i);
throw new IllegalArgumentException(sb2.toString());
}
}
public final int a() {
return this.f - this.b;
}
public final byte[] a(int i, int i2) {
if (i2 == 0) {
return zzyl.d;
}
byte[] bArr = new byte[i2];
System.arraycopy(this.a, this.b + i, bArr, 0, i2);
return bArr;
}
}