235 lines
7.9 KiB
Java
235 lines
7.9 KiB
Java
|
package com.google.android.libraries.places.internal;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class zzaei extends zzael {
|
||
|
private final byte[] zzc;
|
||
|
private final int zzd;
|
||
|
private int zze;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public zzaei(byte[] bArr, int i, int i2) {
|
||
|
super(null);
|
||
|
if (bArr == null) {
|
||
|
throw new NullPointerException("buffer");
|
||
|
}
|
||
|
int length = bArr.length;
|
||
|
if (((length - i2) | i2) < 0) {
|
||
|
throw new IllegalArgumentException(String.format("Array range is invalid. Buffer.length=%d, offset=%d, length=%d", Integer.valueOf(length), 0, Integer.valueOf(i2)));
|
||
|
}
|
||
|
this.zzc = bArr;
|
||
|
this.zze = 0;
|
||
|
this.zzd = i2;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzb(byte b) throws IOException {
|
||
|
try {
|
||
|
byte[] bArr = this.zzc;
|
||
|
int i = this.zze;
|
||
|
this.zze = i + 1;
|
||
|
bArr[i] = b;
|
||
|
} catch (IndexOutOfBoundsException e) {
|
||
|
throw new zzaej(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.zze), Integer.valueOf(this.zzd), 1), e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void zzc(byte[] bArr, int i, int i2) throws IOException {
|
||
|
try {
|
||
|
System.arraycopy(bArr, 0, this.zzc, this.zze, i2);
|
||
|
this.zze += i2;
|
||
|
} catch (IndexOutOfBoundsException e) {
|
||
|
throw new zzaej(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.zze), Integer.valueOf(this.zzd), Integer.valueOf(i2)), e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzd(int i, boolean z) throws IOException {
|
||
|
zzq(i << 3);
|
||
|
zzb(z ? (byte) 1 : (byte) 0);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zze(int i, zzaed zzaedVar) throws IOException {
|
||
|
zzq((i << 3) | 2);
|
||
|
zzq(zzaedVar.zzd());
|
||
|
zzaedVar.zzh(this);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzf(int i, int i2) throws IOException {
|
||
|
zzq((i << 3) | 5);
|
||
|
zzg(i2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzg(int i) throws IOException {
|
||
|
try {
|
||
|
byte[] bArr = this.zzc;
|
||
|
int i2 = this.zze;
|
||
|
bArr[i2] = (byte) i;
|
||
|
bArr[i2 + 1] = (byte) (i >> 8);
|
||
|
bArr[i2 + 2] = (byte) (i >> 16);
|
||
|
this.zze = i2 + 4;
|
||
|
bArr[i2 + 3] = (byte) (i >>> 24);
|
||
|
} catch (IndexOutOfBoundsException e) {
|
||
|
throw new zzaej(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.zze), Integer.valueOf(this.zzd), 1), e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzh(int i, long j) throws IOException {
|
||
|
zzq((i << 3) | 1);
|
||
|
zzi(j);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzi(long j) throws IOException {
|
||
|
try {
|
||
|
byte[] bArr = this.zzc;
|
||
|
int i = this.zze;
|
||
|
bArr[i] = (byte) j;
|
||
|
bArr[i + 1] = (byte) (j >> 8);
|
||
|
bArr[i + 2] = (byte) (j >> 16);
|
||
|
bArr[i + 3] = (byte) (j >> 24);
|
||
|
bArr[i + 4] = (byte) (j >> 32);
|
||
|
bArr[i + 5] = (byte) (j >> 40);
|
||
|
bArr[i + 6] = (byte) (j >> 48);
|
||
|
this.zze = i + 8;
|
||
|
bArr[i + 7] = (byte) (j >> 56);
|
||
|
} catch (IndexOutOfBoundsException e) {
|
||
|
throw new zzaej(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.zze), Integer.valueOf(this.zzd), 1), e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzj(int i, int i2) throws IOException {
|
||
|
zzq(i << 3);
|
||
|
zzk(i2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzk(int i) throws IOException {
|
||
|
if (i >= 0) {
|
||
|
zzq(i);
|
||
|
} else {
|
||
|
zzs(i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzl(byte[] bArr, int i, int i2) throws IOException {
|
||
|
zzc(bArr, 0, i2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzm(int i, String str) throws IOException {
|
||
|
zzq((i << 3) | 2);
|
||
|
zzn(str);
|
||
|
}
|
||
|
|
||
|
public final void zzn(String str) throws IOException {
|
||
|
int i = this.zze;
|
||
|
try {
|
||
|
int zzA = zzA(str.length() * 3);
|
||
|
int zzA2 = zzA(str.length());
|
||
|
if (zzA2 == zzA) {
|
||
|
int i2 = i + zzA2;
|
||
|
this.zze = i2;
|
||
|
int zzb = zzahw.zzb(str, this.zzc, i2, this.zzd - i2);
|
||
|
this.zze = i;
|
||
|
zzq((zzb - i) - zzA2);
|
||
|
this.zze = zzb;
|
||
|
return;
|
||
|
}
|
||
|
zzq(zzahw.zzc(str));
|
||
|
byte[] bArr = this.zzc;
|
||
|
int i3 = this.zze;
|
||
|
this.zze = zzahw.zzb(str, bArr, i3, this.zzd - i3);
|
||
|
} catch (zzahv e) {
|
||
|
this.zze = i;
|
||
|
zzE(str, e);
|
||
|
} catch (IndexOutOfBoundsException e2) {
|
||
|
throw new zzaej(e2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzo(int i, int i2) throws IOException {
|
||
|
zzq((i << 3) | i2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzp(int i, int i2) throws IOException {
|
||
|
zzq(i << 3);
|
||
|
zzq(i2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzr(int i, long j) throws IOException {
|
||
|
zzq(i << 3);
|
||
|
zzs(j);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzq(int i) throws IOException {
|
||
|
while ((i & (-128)) != 0) {
|
||
|
try {
|
||
|
byte[] bArr = this.zzc;
|
||
|
int i2 = this.zze;
|
||
|
this.zze = i2 + 1;
|
||
|
bArr[i2] = (byte) ((i & 127) | 128);
|
||
|
i >>>= 7;
|
||
|
} catch (IndexOutOfBoundsException e) {
|
||
|
throw new zzaej(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.zze), Integer.valueOf(this.zzd), 1), e);
|
||
|
}
|
||
|
}
|
||
|
byte[] bArr2 = this.zzc;
|
||
|
int i3 = this.zze;
|
||
|
this.zze = i3 + 1;
|
||
|
bArr2[i3] = (byte) i;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final void zzs(long j) throws IOException {
|
||
|
boolean z;
|
||
|
z = zzael.zzd;
|
||
|
if (z && this.zzd - this.zze >= 10) {
|
||
|
while ((j & (-128)) != 0) {
|
||
|
byte[] bArr = this.zzc;
|
||
|
int i = this.zze;
|
||
|
this.zze = i + 1;
|
||
|
zzahs.zzn(bArr, i, (byte) ((((int) j) & 127) | 128));
|
||
|
j >>>= 7;
|
||
|
}
|
||
|
byte[] bArr2 = this.zzc;
|
||
|
int i2 = this.zze;
|
||
|
this.zze = i2 + 1;
|
||
|
zzahs.zzn(bArr2, i2, (byte) j);
|
||
|
return;
|
||
|
}
|
||
|
while ((j & (-128)) != 0) {
|
||
|
try {
|
||
|
byte[] bArr3 = this.zzc;
|
||
|
int i3 = this.zze;
|
||
|
this.zze = i3 + 1;
|
||
|
bArr3[i3] = (byte) ((((int) j) & 127) | 128);
|
||
|
j >>>= 7;
|
||
|
} catch (IndexOutOfBoundsException e) {
|
||
|
throw new zzaej(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.zze), Integer.valueOf(this.zzd), 1), e);
|
||
|
}
|
||
|
}
|
||
|
byte[] bArr4 = this.zzc;
|
||
|
int i4 = this.zze;
|
||
|
this.zze = i4 + 1;
|
||
|
bArr4[i4] = (byte) j;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.libraries.places.internal.zzael
|
||
|
public final int zza() {
|
||
|
return this.zzd - this.zze;
|
||
|
}
|
||
|
}
|