553 lines
15 KiB
Java
553 lines
15 KiB
Java
package o;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import com.google.protobuf.CodedOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.InvalidObjectException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.Serializable;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.charset.Charset;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
import java.util.Comparator;
|
|
import java.util.Iterator;
|
|
import java.util.Locale;
|
|
import java.util.NoSuchElementException;
|
|
import o.rPU;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public abstract class QwV implements Iterable<Byte>, Serializable {
|
|
public static final QwV a = new ojQ(MTP.e);
|
|
private static final IeS e;
|
|
private int b = 0;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface HBt extends Iterator<Byte> {
|
|
byte a();
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
interface IeS {
|
|
byte[] c(byte[] bArr, int i, int i2);
|
|
}
|
|
|
|
static /* synthetic */ int b(byte b) {
|
|
return b & UnsignedBytes.MAX_VALUE;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public abstract byte a(int i);
|
|
|
|
protected abstract String a(Charset charset);
|
|
|
|
public abstract QwV a(int i, int i2);
|
|
|
|
public abstract byte b(int i);
|
|
|
|
public abstract void b(MZj mZj) throws IOException;
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public abstract void b(byte[] bArr, int i, int i2, int i3);
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public abstract boolean b();
|
|
|
|
public abstract ByteBuffer c();
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public abstract int d(int i, int i2, int i3);
|
|
|
|
public abstract boolean d();
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public abstract int e();
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public abstract int e(int i, int i2, int i3);
|
|
|
|
public abstract cKE f();
|
|
|
|
public abstract int g();
|
|
|
|
static {
|
|
byte b = 0;
|
|
e = zRL.d() ? new saX(b) : new Sts(b);
|
|
new Comparator<QwV>() { // from class: o.QwV.2
|
|
@Override // java.util.Comparator
|
|
public final /* synthetic */ int compare(QwV qwV, QwV qwV2) {
|
|
QwV qwV3 = qwV;
|
|
QwV qwV4 = qwV2;
|
|
HBt it = qwV3.iterator();
|
|
HBt it2 = qwV4.iterator();
|
|
while (it.hasNext() && it2.hasNext()) {
|
|
int compare = Integer.compare(QwV.b(it.a()), QwV.b(it2.a()));
|
|
if (compare != 0) {
|
|
return compare;
|
|
}
|
|
}
|
|
return Integer.compare(qwV3.g(), qwV4.g());
|
|
}
|
|
};
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static final class saX implements IeS {
|
|
private saX() {
|
|
}
|
|
|
|
/* synthetic */ saX(byte b) {
|
|
this();
|
|
}
|
|
|
|
@Override // o.QwV.IeS
|
|
public final byte[] c(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 Sts implements IeS {
|
|
private Sts() {
|
|
}
|
|
|
|
/* synthetic */ Sts(byte b) {
|
|
this();
|
|
}
|
|
|
|
@Override // o.QwV.IeS
|
|
public final byte[] c(byte[] bArr, int i, int i2) {
|
|
return Arrays.copyOfRange(bArr, i, i2 + i);
|
|
}
|
|
}
|
|
|
|
@Override // java.lang.Iterable
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public HBt iterator() {
|
|
return new LWm(this) { // from class: o.QwV.3
|
|
private int b = 0;
|
|
private QwV c;
|
|
private final int d;
|
|
|
|
{
|
|
this.c = this;
|
|
this.d = this.g();
|
|
}
|
|
|
|
@Override // o.QwV.HBt
|
|
public final byte a() {
|
|
int i = this.b;
|
|
if (i >= this.d) {
|
|
throw new NoSuchElementException();
|
|
}
|
|
this.b = i + 1;
|
|
return this.c.a(i);
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public final boolean hasNext() {
|
|
return this.b < this.d;
|
|
}
|
|
};
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static abstract class LWm implements HBt {
|
|
@Override // java.util.Iterator
|
|
public final void remove() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public /* synthetic */ Byte next() {
|
|
return Byte.valueOf(a());
|
|
}
|
|
}
|
|
|
|
public static QwV c(byte[] bArr, int i, int i2) {
|
|
a(i, i + i2, bArr.length);
|
|
return new ojQ(e.c(bArr, i, i2));
|
|
}
|
|
|
|
public static QwV b(byte[] bArr) {
|
|
int length = bArr.length;
|
|
a(0, length, bArr.length);
|
|
return new ojQ(e.c(bArr, 0, length));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static QwV d(byte[] bArr) {
|
|
return new ojQ(bArr);
|
|
}
|
|
|
|
public static QwV c(String str) {
|
|
return new ojQ(str.getBytes(MTP.b));
|
|
}
|
|
|
|
public static QwV b(Iterable<QwV> iterable) {
|
|
int size;
|
|
if (!(iterable instanceof Collection)) {
|
|
Iterator<QwV> it = iterable.iterator();
|
|
size = 0;
|
|
while (it.hasNext()) {
|
|
it.next();
|
|
size++;
|
|
}
|
|
} else {
|
|
size = ((Collection) iterable).size();
|
|
}
|
|
return size == 0 ? a : b(iterable.iterator(), size);
|
|
}
|
|
|
|
private static QwV b(Iterator<QwV> it, int i) {
|
|
if (i <= 0) {
|
|
throw new IllegalArgumentException(String.format("length (%s) must be >= 1", Integer.valueOf(i)));
|
|
}
|
|
if (i == 1) {
|
|
return it.next();
|
|
}
|
|
int i2 = i >>> 1;
|
|
QwV b = b(it, i2);
|
|
QwV b2 = b(it, i - i2);
|
|
if (Integer.MAX_VALUE - b.g() < b2.g()) {
|
|
StringBuilder sb = new StringBuilder("ByteString would be too long: ");
|
|
sb.append(b.g());
|
|
sb.append("+");
|
|
sb.append(b2.g());
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
return RAv.a(b, b2);
|
|
}
|
|
|
|
@Deprecated
|
|
public final void d(byte[] bArr, int i, int i2) {
|
|
a(0, i2, g());
|
|
a(i, i + i2, bArr.length);
|
|
if (i2 > 0) {
|
|
b(bArr, 0, i, i2);
|
|
}
|
|
}
|
|
|
|
public final byte[] j() {
|
|
int g = g();
|
|
if (g == 0) {
|
|
return MTP.e;
|
|
}
|
|
byte[] bArr = new byte[g];
|
|
b(bArr, 0, 0, g);
|
|
return bArr;
|
|
}
|
|
|
|
public final String i() {
|
|
return g() == 0 ? "" : a(MTP.b);
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static abstract class tOB extends QwV {
|
|
@Override // o.QwV
|
|
protected final boolean b() {
|
|
return true;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public abstract boolean c(QwV qwV, int i, int i2);
|
|
|
|
@Override // o.QwV
|
|
protected final int e() {
|
|
return 0;
|
|
}
|
|
|
|
tOB() {
|
|
}
|
|
|
|
@Override // o.QwV, java.lang.Iterable
|
|
public /* synthetic */ Iterator<Byte> iterator() {
|
|
return super.iterator();
|
|
}
|
|
}
|
|
|
|
public final int hashCode() {
|
|
int i = this.b;
|
|
if (i == 0) {
|
|
int g = g();
|
|
i = d(g, 0, g);
|
|
if (i == 0) {
|
|
i = 1;
|
|
}
|
|
this.b = i;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static jbe d(int i) {
|
|
return new jbe(i, (byte) 0);
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static final class jbe {
|
|
final CodedOutputStream a;
|
|
final byte[] c;
|
|
|
|
/* synthetic */ jbe(int i, byte b) {
|
|
this(i);
|
|
}
|
|
|
|
private jbe(int i) {
|
|
byte[] bArr = new byte[i];
|
|
this.c = bArr;
|
|
this.a = CodedOutputStream.a(bArr);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static void b(int i, int i2) {
|
|
if (((i2 - (i + 1)) | i) < 0) {
|
|
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());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static int a(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 g = g();
|
|
if (g() <= 50) {
|
|
obj = rPU.c(new rPU.AnonymousClass5(this));
|
|
} else {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(rPU.c(new rPU.AnonymousClass5(a(0, 47))));
|
|
sb.append("...");
|
|
obj = sb.toString();
|
|
}
|
|
return String.format(locale, "<ByteString@%s size=%d contents=\"%s\">", hexString, Integer.valueOf(g), obj);
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static class ojQ extends tOB {
|
|
protected final byte[] d;
|
|
|
|
protected int l() {
|
|
return 0;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public ojQ(byte[] bArr) {
|
|
this.d = bArr;
|
|
}
|
|
|
|
@Override // o.QwV
|
|
public byte b(int i) {
|
|
return this.d[i];
|
|
}
|
|
|
|
@Override // o.QwV
|
|
byte a(int i) {
|
|
return this.d[i];
|
|
}
|
|
|
|
@Override // o.QwV
|
|
public int g() {
|
|
return this.d.length;
|
|
}
|
|
|
|
@Override // o.QwV
|
|
public final QwV a(int i, int i2) {
|
|
int a = a(i, i2, g());
|
|
if (a == 0) {
|
|
return QwV.a;
|
|
}
|
|
return new RVV(this.d, l() + i, a);
|
|
}
|
|
|
|
@Override // o.QwV
|
|
protected void b(byte[] bArr, int i, int i2, int i3) {
|
|
System.arraycopy(this.d, i, bArr, i2, i3);
|
|
}
|
|
|
|
@Override // o.QwV
|
|
public final ByteBuffer c() {
|
|
return ByteBuffer.wrap(this.d, l(), g()).asReadOnlyBuffer();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // o.QwV
|
|
public final void b(MZj mZj) throws IOException {
|
|
mZj.b(this.d, l(), g());
|
|
}
|
|
|
|
@Override // o.QwV
|
|
protected final String a(Charset charset) {
|
|
return new String(this.d, l(), g(), charset);
|
|
}
|
|
|
|
@Override // o.QwV
|
|
public final boolean d() {
|
|
int l = l();
|
|
return C16752qto.a(this.d, l, g() + l);
|
|
}
|
|
|
|
@Override // o.QwV
|
|
protected final int e(int i, int i2, int i3) {
|
|
int l = l() + i2;
|
|
return C16752qto.c(i, this.d, l, i3 + l);
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof QwV) || g() != ((QwV) obj).g()) {
|
|
return false;
|
|
}
|
|
if (g() == 0) {
|
|
return true;
|
|
}
|
|
if (obj instanceof ojQ) {
|
|
ojQ ojq = (ojQ) obj;
|
|
int h = h();
|
|
int h2 = ojq.h();
|
|
if (h == 0 || h2 == 0 || h == h2) {
|
|
return c(ojq, 0, g());
|
|
}
|
|
return false;
|
|
}
|
|
return obj.equals(this);
|
|
}
|
|
|
|
@Override // o.QwV.tOB
|
|
final boolean c(QwV qwV, int i, int i2) {
|
|
if (i2 > qwV.g()) {
|
|
StringBuilder sb = new StringBuilder("Length too large: ");
|
|
sb.append(i2);
|
|
sb.append(g());
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
int i3 = i + i2;
|
|
if (i3 > qwV.g()) {
|
|
StringBuilder sb2 = new StringBuilder("Ran off end of other: ");
|
|
sb2.append(i);
|
|
sb2.append(", ");
|
|
sb2.append(i2);
|
|
sb2.append(", ");
|
|
sb2.append(qwV.g());
|
|
throw new IllegalArgumentException(sb2.toString());
|
|
}
|
|
if (qwV instanceof ojQ) {
|
|
ojQ ojq = (ojQ) qwV;
|
|
byte[] bArr = this.d;
|
|
byte[] bArr2 = ojq.d;
|
|
int l = l();
|
|
int l2 = l();
|
|
int l3 = ojq.l() + i;
|
|
while (l2 < l + i2) {
|
|
if (bArr[l2] != bArr2[l3]) {
|
|
return false;
|
|
}
|
|
l2++;
|
|
l3++;
|
|
}
|
|
return true;
|
|
}
|
|
return qwV.a(i, i3).equals(a(0, i2));
|
|
}
|
|
|
|
@Override // o.QwV
|
|
protected final int d(int i, int i2, int i3) {
|
|
return MTP.c(i, this.d, l() + i2, i3);
|
|
}
|
|
|
|
@Override // o.QwV
|
|
public final cKE f() {
|
|
return cKE.c(this.d, l(), g(), true);
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static final class RVV extends ojQ {
|
|
private final int b;
|
|
private final int e;
|
|
|
|
RVV(byte[] bArr, int i, int i2) {
|
|
super(bArr);
|
|
a(i, i + i2, bArr.length);
|
|
this.b = i;
|
|
this.e = i2;
|
|
}
|
|
|
|
@Override // o.QwV.ojQ, o.QwV
|
|
final byte a(int i) {
|
|
return this.d[this.b + i];
|
|
}
|
|
|
|
@Override // o.QwV.ojQ, o.QwV
|
|
protected final void b(byte[] bArr, int i, int i2, int i3) {
|
|
System.arraycopy(this.d, this.b + i, bArr, i2, i3);
|
|
}
|
|
|
|
final Object writeReplace() {
|
|
return new ojQ(j());
|
|
}
|
|
|
|
private void readObject(ObjectInputStream objectInputStream) throws IOException {
|
|
throw new InvalidObjectException("BoundedByteStream instances are not to be serialized directly");
|
|
}
|
|
|
|
@Override // o.QwV.ojQ, o.QwV
|
|
public final byte b(int i) {
|
|
b(i, this.e);
|
|
return this.d[this.b + i];
|
|
}
|
|
|
|
@Override // o.QwV.ojQ, o.QwV
|
|
public final int g() {
|
|
return this.e;
|
|
}
|
|
|
|
@Override // o.QwV.ojQ
|
|
protected final int l() {
|
|
return this.b;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public final int h() {
|
|
return this.b;
|
|
}
|
|
}
|