package o; import com.google.common.primitives.UnsignedBytes; import com.google.crypto.tink.shaded.protobuf.CodedOutputStream; import java.io.IOException; import java.io.InvalidObjectException; import java.io.ObjectInputStream; import java.io.Serializable; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Comparator; import java.util.Iterator; import java.util.Locale; import java.util.NoSuchElementException; import o.Xkw; /* loaded from: classes2.dex */ public abstract class jra implements Iterable, Serializable { private static final LWm b; public static final jra d = new tOB(oZe.d); private int a = 0; /* loaded from: classes2.dex */ interface LWm { byte[] b(byte[] bArr, int i, int i2); } /* loaded from: classes2.dex */ public interface RVV extends Iterator { byte d(); } static /* synthetic */ int e(byte b2) { return b2 & UnsignedBytes.MAX_VALUE; } abstract byte a(int i); public abstract byte b(int i); protected abstract int b(int i, int i2); protected abstract String b(Charset charset); public abstract SXg b(); public abstract jra c(int i); public abstract int d(); public abstract void e(AbstractC1058UrZ abstractC1058UrZ) throws IOException; protected abstract void e(byte[] bArr, int i); public abstract boolean e(); static { byte b2 = 0; b = C3269auN.e() ? new jbe(b2) : new IeS(b2); new Comparator() { // from class: o.jra.3 @Override // java.util.Comparator public final /* synthetic */ int compare(jra jraVar, jra jraVar2) { jra jraVar3 = jraVar; jra jraVar4 = jraVar2; AnonymousClass4 anonymousClass4 = new AnonymousClass4(jraVar3); AnonymousClass4 anonymousClass42 = new AnonymousClass4(jraVar4); while (anonymousClass4.hasNext() && anonymousClass42.hasNext()) { int compare = Integer.compare(jra.e(anonymousClass4.d()), jra.e(anonymousClass42.d())); if (compare != 0) { return compare; } } return Integer.compare(jraVar3.d(), jraVar4.d()); } }; } /* loaded from: classes2.dex */ static final class jbe implements LWm { private jbe() { } /* synthetic */ jbe(byte b) { this(); } @Override // o.jra.LWm public final byte[] b(byte[] bArr, int i, int i2) { byte[] bArr2 = new byte[i2]; System.arraycopy(bArr, i, bArr2, 0, i2); return bArr2; } } /* loaded from: classes2.dex */ static final class IeS implements LWm { private IeS() { } /* synthetic */ IeS(byte b) { this(); } @Override // o.jra.LWm public final byte[] b(byte[] bArr, int i, int i2) { return Arrays.copyOfRange(bArr, i, i2 + i); } } jra() { } /* renamed from: o.jra$4, reason: invalid class name */ /* loaded from: classes2.dex */ final class AnonymousClass4 extends Sts { private jra a; private int d = 0; private final int e; AnonymousClass4(jra jraVar) { this.a = jraVar; this.e = jraVar.d(); } @Override // o.jra.RVV public final byte d() { int i = this.d; if (i >= this.e) { throw new NoSuchElementException(); } this.d = i + 1; return this.a.a(i); } @Override // java.util.Iterator public final boolean hasNext() { return this.d < this.e; } } /* loaded from: classes2.dex */ static abstract class Sts implements RVV { Sts() { } @Override // java.util.Iterator public final void remove() { throw new UnsupportedOperationException(); } @Override // java.util.Iterator public /* synthetic */ Byte next() { return Byte.valueOf(d()); } } public static jra d(byte[] bArr, int i, int i2) { c(i, i + i2, bArr.length); return new tOB(b.b(bArr, i, i2)); } public static jra e(byte[] bArr) { int length = bArr.length; c(0, length, bArr.length); return new tOB(b.b(bArr, 0, length)); } /* JADX INFO: Access modifiers changed from: package-private */ public static jra b(byte[] bArr) { return new tOB(bArr); } public static jra e(String str) { return new tOB(str.getBytes(oZe.b)); } public final byte[] c() { int d2 = d(); if (d2 == 0) { return oZe.d; } byte[] bArr = new byte[d2]; e(bArr, d2); return bArr; } public final String f() { return d() == 0 ? "" : b(oZe.b); } /* loaded from: classes2.dex */ static abstract class ojQ extends jra { ojQ() { } } public final int hashCode() { int i = this.a; if (i == 0) { int d2 = d(); i = b(d2, d2); if (i == 0) { i = 1; } this.a = i; } return i; } /* JADX INFO: Access modifiers changed from: package-private */ public static ZqN e(int i) { return new ZqN(i, (byte) 0); } /* loaded from: classes2.dex */ static final class ZqN { final CodedOutputStream c; final byte[] e; /* synthetic */ ZqN(int i, byte b) { this(i); } private ZqN(int i) { byte[] bArr = new byte[i]; this.e = bArr; this.c = CodedOutputStream.b(bArr); } } static int c(int i, int i2, int i3) { int i4 = i2 - i; if ((i | i2 | i4 | (i3 - i2)) >= 0) { return i4; } if (i < 0) { StringBuilder sb = new StringBuilder("Beginning index: "); sb.append(i); sb.append(" < 0"); throw new IndexOutOfBoundsException(sb.toString()); } if (i2 < i) { StringBuilder sb2 = new StringBuilder("Beginning index larger than ending index: "); sb2.append(i); sb2.append(", "); sb2.append(i2); throw new IndexOutOfBoundsException(sb2.toString()); } StringBuilder sb3 = new StringBuilder("End index: "); sb3.append(i2); sb3.append(" >= "); sb3.append(i3); throw new IndexOutOfBoundsException(sb3.toString()); } public final String toString() { String obj; Locale locale = Locale.ROOT; String hexString = Integer.toHexString(System.identityHashCode(this)); int d2 = d(); if (d() <= 50) { obj = Xkw.b(new Xkw.AnonymousClass1(this)); } else { StringBuilder sb = new StringBuilder(); sb.append(Xkw.b(new Xkw.AnonymousClass1(c(47)))); sb.append("..."); obj = sb.toString(); } return String.format(locale, "", hexString, Integer.valueOf(d2), obj); } /* loaded from: classes2.dex */ static class tOB extends ojQ { protected final byte[] a; protected int i() { return 0; } /* JADX INFO: Access modifiers changed from: package-private */ public tOB(byte[] bArr) { this.a = bArr; } @Override // o.jra public byte b(int i) { return this.a[i]; } @Override // o.jra byte a(int i) { return this.a[i]; } @Override // o.jra public int d() { return this.a.length; } @Override // o.jra public final jra c(int i) { int c = c(0, i, d()); if (c == 0) { return jra.d; } return new HBt(this.a, i(), c); } @Override // o.jra protected void e(byte[] bArr, int i) { System.arraycopy(this.a, 0, bArr, 0, i); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.jra public final void e(AbstractC1058UrZ abstractC1058UrZ) throws IOException { abstractC1058UrZ.b(this.a, i(), d()); } @Override // o.jra protected final String b(Charset charset) { return new String(this.a, i(), d(), charset); } @Override // o.jra public final boolean e() { int i = i(); return iEH.d(this.a, i, d() + i); } public final boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof jra) || d() != ((jra) obj).d()) { return false; } if (d() == 0) { return true; } if (obj instanceof tOB) { tOB tob = (tOB) obj; int a = a(); int a2 = tob.a(); if (a != 0 && a2 != 0 && a != a2) { return false; } int d = d(); if (d > tob.d()) { StringBuilder sb = new StringBuilder("Length too large: "); sb.append(d); sb.append(d()); throw new IllegalArgumentException(sb.toString()); } if (d > tob.d()) { StringBuilder sb2 = new StringBuilder("Ran off end of other: 0, "); sb2.append(d); sb2.append(", "); sb2.append(tob.d()); throw new IllegalArgumentException(sb2.toString()); } if (tob instanceof tOB) { byte[] bArr = this.a; byte[] bArr2 = tob.a; int i = i(); int i2 = i(); int i3 = tob.i(); while (i2 < i + d) { if (bArr[i2] != bArr2[i3]) { return false; } i2++; i3++; } return true; } return tob.c(d).equals(c(d)); } return obj.equals(this); } @Override // o.jra protected final int b(int i, int i2) { return oZe.e(i, this.a, i(), i2); } @Override // o.jra public final SXg b() { return SXg.e(this.a, i(), d(), true); } } /* loaded from: classes2.dex */ static final class HBt extends tOB { private final int b; private final int c; HBt(byte[] bArr, int i, int i2) { super(bArr); c(i, i + i2, bArr.length); this.c = i; this.b = i2; } @Override // o.jra.tOB, o.jra final byte a(int i) { return ((tOB) this).a[this.c + i]; } @Override // o.jra.tOB, o.jra protected final void e(byte[] bArr, int i) { System.arraycopy(((tOB) this).a, this.c, bArr, 0, i); } final Object writeReplace() { return new tOB(c()); } private void readObject(ObjectInputStream objectInputStream) throws IOException { throw new InvalidObjectException("BoundedByteStream instances are not to be serialized directly"); } @Override // o.jra.tOB, o.jra public final byte b(int i) { int i2 = this.b; if (((i2 - (i + 1)) | i) >= 0) { return ((tOB) this).a[this.c + i]; } if (i < 0) { throw new ArrayIndexOutOfBoundsException("Index < 0: ".concat(String.valueOf(i))); } StringBuilder sb = new StringBuilder("Index > length: "); sb.append(i); sb.append(", "); sb.append(i2); throw new ArrayIndexOutOfBoundsException(sb.toString()); } @Override // o.jra.tOB, o.jra public final int d() { return this.b; } @Override // o.jra.tOB protected final int i() { return this.c; } } @Override // java.lang.Iterable public /* synthetic */ Iterator iterator() { return new AnonymousClass4(this); } protected final int a() { return this.a; } }