what-the-bank/sources/com/google/crypto/tink/shaded/protobuf/CodedOutputStream.java

718 lines
22 KiB
Java

package com.google.crypto.tink.shaded.protobuf;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import o.AbstractC1058UrZ;
import o.AbstractC16771rBp;
import o.C15775iXO;
import o.C1609aJC;
import o.C3269auN;
import o.C9356diG;
import o.CSi;
import o.GAv;
import o.iEH;
import o.jra;
import o.oZe;
import o.vAr;
/* loaded from: classes2.dex */
public abstract class CodedOutputStream extends AbstractC1058UrZ {
private static final Logger a = Logger.getLogger(CodedOutputStream.class.getName());
private static final boolean d = C1609aJC.a();
public boolean b;
public C9356diG e;
public static int a() {
return 8;
}
public static int a(long j) {
int i;
if (((-128) & j) == 0) {
return 1;
}
if (j < 0) {
return 10;
}
if (((-34359738368L) & j) != 0) {
j >>>= 28;
i = 6;
} else {
i = 2;
}
if (((-2097152) & j) != 0) {
i += 2;
j >>>= 14;
}
return (j & (-16384)) != 0 ? i + 1 : i;
}
public static int c() {
return 8;
}
public static int d() {
return 4;
}
public static int e() {
return 1;
}
public static int f() {
return 4;
}
public static int g() {
return 4;
}
public static int h() {
return 8;
}
public static int l(int i) {
if ((i & (-128)) == 0) {
return 1;
}
if ((i & (-16384)) == 0) {
return 2;
}
if (((-2097152) & i) == 0) {
return 3;
}
return (i & (-268435456)) == 0 ? 4 : 5;
}
public abstract void a(int i, jra jraVar) throws IOException;
public abstract void a(String str) throws IOException;
public abstract void a(vAr var) throws IOException;
public abstract void a(byte[] bArr, int i) throws IOException;
public abstract void b(int i, long j) throws IOException;
public abstract void b(int i, boolean z) throws IOException;
public abstract void c(byte b) throws IOException;
public abstract void c(int i, long j) throws IOException;
public abstract void d(int i, String str) throws IOException;
public abstract void d(int i, vAr var) throws IOException;
public abstract void d(long j) throws IOException;
public abstract void d(jra jraVar) throws IOException;
public abstract void e(int i, int i2) throws IOException;
public abstract void e(int i, jra jraVar) throws IOException;
public abstract void e(int i, vAr var, CSi cSi) throws IOException;
public abstract void e(long j) throws IOException;
public abstract void g(int i, int i2) throws IOException;
public abstract void i(int i, int i2) throws IOException;
public abstract int j();
public abstract void j(int i, int i2) throws IOException;
public abstract void o(int i) throws IOException;
public abstract void q(int i) throws IOException;
public abstract void r(int i) throws IOException;
/* synthetic */ CodedOutputStream(byte b) {
this();
}
public static CodedOutputStream b(byte[] bArr) {
return new Sts(bArr, bArr.length);
}
private CodedOutputStream() {
}
public static int m(int i) {
return l(C15775iXO.b(i, 0));
}
public static int i(int i) {
if (i >= 0) {
return l(i);
}
return 10;
}
public static int k(int i) {
return l((i << 1) ^ (i >> 31));
}
public static int b(long j) {
return a(j);
}
public static int c(long j) {
return a((j << 1) ^ (j >> 63));
}
public static int b(String str) {
int length;
try {
length = iEH.d(str);
} catch (iEH.Sts unused) {
length = str.getBytes(oZe.b).length;
}
return l(length) + length;
}
public static int b(GAv gAv) {
int a2 = gAv.a();
return l(a2) + a2;
}
public static int c(jra jraVar) {
int d2 = jraVar.d();
return l(d2) + d2;
}
public static int e(byte[] bArr) {
int length = bArr.length;
return l(length) + length;
}
public static int b(vAr var) {
int n = var.n();
return l(n) + n;
}
public static int c(vAr var, CSi cSi) {
AbstractC16771rBp abstractC16771rBp = (AbstractC16771rBp) var;
int i = abstractC16771rBp.i();
if (i == -1) {
i = cSi.a(abstractC16771rBp);
abstractC16771rBp.b(i);
}
return l(i) + i;
}
public static int j(int i) {
return l(i) + i;
}
/* loaded from: classes2.dex */
public static class OutOfSpaceException extends IOException {
OutOfSpaceException() {
super("CodedOutputStream was writing to a flat byte array and ran out of space.");
}
OutOfSpaceException(Throwable th) {
super("CodedOutputStream was writing to a flat byte array and ran out of space.", th);
}
public OutOfSpaceException(String str, Throwable th) {
super("CodedOutputStream was writing to a flat byte array and ran out of space.: ".concat(String.valueOf(str)), th);
}
}
final void c(String str, iEH.Sts sts) throws IOException {
a.log(Level.WARNING, "Converting ill-formed UTF-16. Your Protocol Buffer will not round trip correctly!", (Throwable) sts);
byte[] bytes = str.getBytes(oZe.b);
try {
r(bytes.length);
b(bytes, 0, bytes.length);
} catch (OutOfSpaceException e) {
throw e;
} catch (IndexOutOfBoundsException e2) {
throw new OutOfSpaceException(e2);
}
}
@Deprecated
public static int c(vAr var) {
return var.n();
}
@Deprecated
public static int f(int i) {
return l(i);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public static class Sts extends CodedOutputStream {
private final int a;
private final byte[] c;
private final int d;
private int f;
Sts(byte[] bArr, int i) {
super((byte) 0);
if (bArr == null) {
throw new NullPointerException("buffer");
}
if (((bArr.length - i) | i) < 0) {
throw new IllegalArgumentException(String.format("Array range is invalid. Buffer.length=%d, offset=%d, length=%d", Integer.valueOf(bArr.length), 0, Integer.valueOf(i)));
}
this.c = bArr;
this.d = 0;
this.f = 0;
this.a = i;
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void g(int i, int i2) throws IOException {
r(C15775iXO.b(i, i2));
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void d(jra jraVar) throws IOException {
r(jraVar.d());
jraVar.e(this);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void a(byte[] bArr, int i) throws IOException {
r(i);
c(bArr, 0, i);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void a(vAr var) throws IOException {
r(var.n());
var.b(this);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void c(byte b) throws IOException {
try {
byte[] bArr = this.c;
int i = this.f;
this.f = i + 1;
bArr[i] = b;
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.f), Integer.valueOf(this.a), 1), e);
}
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void q(int i) throws IOException {
if (i >= 0) {
r(i);
} else {
e(i);
}
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void r(int i) throws IOException {
if (CodedOutputStream.d && !C3269auN.e()) {
int i2 = this.a;
int i3 = this.f;
if (i2 - i3 >= 5) {
if ((i & (-128)) == 0) {
byte[] bArr = this.c;
this.f = i3 + 1;
C1609aJC.c(bArr, i3, (byte) i);
return;
}
byte[] bArr2 = this.c;
this.f = i3 + 1;
C1609aJC.c(bArr2, i3, (byte) (i | 128));
int i4 = i >>> 7;
if ((i4 & (-128)) == 0) {
byte[] bArr3 = this.c;
int i5 = this.f;
this.f = i5 + 1;
C1609aJC.c(bArr3, i5, (byte) i4);
return;
}
byte[] bArr4 = this.c;
int i6 = this.f;
this.f = i6 + 1;
C1609aJC.c(bArr4, i6, (byte) (i4 | 128));
int i7 = i >>> 14;
if ((i7 & (-128)) == 0) {
byte[] bArr5 = this.c;
int i8 = this.f;
this.f = i8 + 1;
C1609aJC.c(bArr5, i8, (byte) i7);
return;
}
byte[] bArr6 = this.c;
int i9 = this.f;
this.f = i9 + 1;
C1609aJC.c(bArr6, i9, (byte) (i7 | 128));
int i10 = i >>> 21;
if ((i10 & (-128)) == 0) {
byte[] bArr7 = this.c;
int i11 = this.f;
this.f = i11 + 1;
C1609aJC.c(bArr7, i11, (byte) i10);
return;
}
byte[] bArr8 = this.c;
int i12 = this.f;
this.f = i12 + 1;
C1609aJC.c(bArr8, i12, (byte) (i10 | 128));
byte[] bArr9 = this.c;
int i13 = this.f;
this.f = i13 + 1;
C1609aJC.c(bArr9, i13, (byte) (i >>> 28));
return;
}
}
while ((i & (-128)) != 0) {
try {
byte[] bArr10 = this.c;
int i14 = this.f;
this.f = i14 + 1;
bArr10[i14] = (byte) ((i & 127) | 128);
i >>>= 7;
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.f), Integer.valueOf(this.a), 1), e);
}
}
byte[] bArr11 = this.c;
int i15 = this.f;
this.f = i15 + 1;
bArr11[i15] = (byte) i;
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void o(int i) throws IOException {
try {
byte[] bArr = this.c;
int i2 = this.f;
bArr[i2] = (byte) i;
bArr[i2 + 1] = (byte) (i >> 8);
bArr[i2 + 2] = (byte) (i >> 16);
this.f = i2 + 4;
bArr[i2 + 3] = (byte) (i >>> 24);
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.f), Integer.valueOf(this.a), 1), e);
}
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void e(long j) throws IOException {
if (CodedOutputStream.d && this.a - this.f >= 10) {
while ((j & (-128)) != 0) {
byte[] bArr = this.c;
int i = this.f;
this.f = i + 1;
C1609aJC.c(bArr, i, (byte) ((((int) j) & 127) | 128));
j >>>= 7;
}
byte[] bArr2 = this.c;
int i2 = this.f;
this.f = i2 + 1;
C1609aJC.c(bArr2, i2, (byte) j);
return;
}
while ((j & (-128)) != 0) {
try {
byte[] bArr3 = this.c;
int i3 = this.f;
this.f = i3 + 1;
bArr3[i3] = (byte) ((((int) j) & 127) | 128);
j >>>= 7;
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.f), Integer.valueOf(this.a), 1), e);
}
}
byte[] bArr4 = this.c;
int i4 = this.f;
this.f = i4 + 1;
bArr4[i4] = (byte) j;
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void d(long j) throws IOException {
try {
byte[] bArr = this.c;
int i = this.f;
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.f = i + 8;
bArr[i + 7] = (byte) (j >> 56);
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.f), Integer.valueOf(this.a), 1), e);
}
}
private void c(byte[] bArr, int i, int i2) throws IOException {
try {
System.arraycopy(bArr, i, this.c, this.f, i2);
this.f += i2;
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(String.format("Pos: %d, limit: %d, len: %d", Integer.valueOf(this.f), Integer.valueOf(this.a), Integer.valueOf(i2)), e);
}
}
@Override // o.AbstractC1058UrZ
public final void b(byte[] bArr, int i, int i2) throws IOException {
c(bArr, i, i2);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void a(String str) throws IOException {
int i = this.f;
try {
int l = l(str.length() * 3);
int l2 = l(str.length());
if (l2 == l) {
int i2 = i + l2;
this.f = i2;
int b = iEH.b(str, this.c, i2, this.a - i2);
this.f = i;
r((b - i) - l2);
this.f = b;
return;
}
r(iEH.d(str));
byte[] bArr = this.c;
int i3 = this.f;
this.f = iEH.b(str, bArr, i3, this.a - i3);
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(e);
} catch (iEH.Sts e2) {
this.f = i;
c(str, e2);
}
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void b(int i, boolean z) throws IOException {
r(C15775iXO.b(i, 0));
c(z ? (byte) 1 : (byte) 0);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void a(int i, jra jraVar) throws IOException {
r(C15775iXO.b(i, 2));
r(jraVar.d());
jraVar.e(this);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void e(int i, int i2) throws IOException {
r(C15775iXO.b(i, 5));
o(i2);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void b(int i, long j) throws IOException {
r(C15775iXO.b(i, 1));
d(j);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void i(int i, int i2) throws IOException {
r(C15775iXO.b(i, 0));
if (i2 >= 0) {
r(i2);
} else {
e(i2);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void e(int i, vAr var, CSi cSi) throws IOException {
r(C15775iXO.b(i, 2));
AbstractC16771rBp abstractC16771rBp = (AbstractC16771rBp) var;
int i2 = abstractC16771rBp.i();
if (i2 == -1) {
i2 = cSi.a(abstractC16771rBp);
abstractC16771rBp.b(i2);
}
r(i2);
cSi.b(var, this.e);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void d(int i, vAr var) throws IOException {
r(C15775iXO.b(1, 3));
g(2, 0);
r(i);
r(C15775iXO.b(3, 2));
r(var.n());
var.b(this);
r(C15775iXO.b(1, 4));
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void e(int i, jra jraVar) throws IOException {
r(C15775iXO.b(1, 3));
g(2, 0);
r(i);
a(3, jraVar);
r(C15775iXO.b(1, 4));
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void d(int i, String str) throws IOException {
r(C15775iXO.b(i, 2));
a(str);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void j(int i, int i2) throws IOException {
r(C15775iXO.b(i, 0));
r(i2);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final void c(int i, long j) throws IOException {
r(C15775iXO.b(i, 0));
e(j);
}
@Override // com.google.crypto.tink.shaded.protobuf.CodedOutputStream
public final int j() {
return this.a - this.f;
}
}
public static int e(int i) {
return l(C15775iXO.b(i, 0)) + 1;
}
public static int d(int i, jra jraVar) {
int l = l(C15775iXO.b(i, 0));
int d2 = jraVar.d();
return l + l(d2) + d2;
}
public static int c(int i) {
return l(C15775iXO.b(i, 0)) + 8;
}
public static int d(int i, int i2) {
return l(C15775iXO.b(i, 0)) + (i2 >= 0 ? l(i2) : 10);
}
public static int d(int i) {
if (i >= 0) {
return l(i);
}
return 10;
}
public static int a(int i) {
return l(C15775iXO.b(i, 0)) + 4;
}
public static int b(int i) {
return l(C15775iXO.b(i, 0)) + 8;
}
public static int h(int i) {
return l(C15775iXO.b(i, 0)) + 4;
}
@Deprecated
public static int d(int i, vAr var, CSi cSi) {
int l = l(C15775iXO.b(i, 0)) << 1;
AbstractC16771rBp abstractC16771rBp = (AbstractC16771rBp) var;
int i2 = abstractC16771rBp.i();
if (i2 == -1) {
i2 = cSi.a(abstractC16771rBp);
abstractC16771rBp.b(i2);
}
return l + i2;
}
public static int c(int i, int i2) {
return l(C15775iXO.b(i, 0)) + (i2 >= 0 ? l(i2) : 10);
}
public static int d(int i, long j) {
return l(C15775iXO.b(i, 0)) + a(j);
}
public static int b(int i, GAv gAv) {
int l = l(C15775iXO.b(1, 0));
int l2 = l(C15775iXO.b(2, 0)) + l(i);
int l3 = l(C15775iXO.b(3, 0));
int a2 = gAv.a();
return (l << 1) + l2 + l3 + l(a2) + a2;
}
public static int a(int i, GAv gAv) {
int l = l(C15775iXO.b(i, 0));
int a2 = gAv.a();
return l + l(a2) + a2;
}
public static int b(int i, vAr var) {
int l = l(C15775iXO.b(1, 0));
int l2 = l(C15775iXO.b(2, 0)) + l(i);
int l3 = l(C15775iXO.b(3, 0));
int n = var.n();
return (l << 1) + l2 + l3 + l(n) + n;
}
public static int c(int i, vAr var, CSi cSi) {
int l = l(C15775iXO.b(i, 0));
AbstractC16771rBp abstractC16771rBp = (AbstractC16771rBp) var;
int i2 = abstractC16771rBp.i();
if (i2 == -1) {
i2 = cSi.a(abstractC16771rBp);
abstractC16771rBp.b(i2);
}
return l + l(i2) + i2;
}
public static int b(int i, jra jraVar) {
int l = l(C15775iXO.b(1, 0));
int l2 = l(C15775iXO.b(2, 0)) + l(i);
int l3 = l(C15775iXO.b(3, 0));
int d2 = jraVar.d();
return (l << 1) + l2 + l3 + l(d2) + d2;
}
public static int g(int i) {
return l(C15775iXO.b(i, 0)) + 4;
}
public static int n(int i) {
return l(C15775iXO.b(i, 0)) + 8;
}
public static int b(int i, int i2) {
return l(C15775iXO.b(i, 0)) + l((i2 << 1) ^ (i2 >> 31));
}
public static int a(int i, long j) {
return l(C15775iXO.b(i, 0)) + a((j << 1) ^ (j >> 63));
}
public static int a(int i, String str) {
return l(C15775iXO.b(i, 0)) + b(str);
}
public static int a(int i, int i2) {
return l(C15775iXO.b(i, 0)) + l(i2);
}
public static int e(int i, long j) {
return l(C15775iXO.b(i, 0)) + a(j);
}
}