package o; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.SparseIntArray; import androidx.versionedparcelable.VersionedParcel; import java.lang.reflect.Method; /* loaded from: classes.dex */ public final class ZCM extends VersionedParcel { private int a; private final int c; private final Parcel f; private int g; private int h; private final int i; private final SparseIntArray j; /* renamed from: o, reason: collision with root package name */ private final String f8476o; public ZCM(Parcel parcel) { this(parcel, parcel.dataPosition(), parcel.dataSize(), "", new nyh(), new nyh(), new nyh()); } private ZCM(Parcel parcel, int i, int i2, String str, nyh nyhVar, nyh nyhVar2, nyh nyhVar3) { super(nyhVar, nyhVar2, nyhVar3); this.j = new SparseIntArray(); this.a = -1; this.g = -1; this.f = parcel; this.i = i; this.c = i2; this.h = i; this.f8476o = str; } @Override // androidx.versionedparcelable.VersionedParcel public final boolean a(int i) { while (this.h < this.c) { int i2 = this.g; if (i2 == i) { return true; } if (String.valueOf(i2).compareTo(String.valueOf(i)) > 0) { return false; } this.f.setDataPosition(this.h); int readInt = this.f.readInt(); this.g = this.f.readInt(); this.h += readInt; } return this.g == i; } @Override // androidx.versionedparcelable.VersionedParcel public final void b(int i) { e(); this.a = i; this.j.put(i, this.f.dataPosition()); this.f.writeInt(0); this.f.writeInt(i); } @Override // androidx.versionedparcelable.VersionedParcel public final void e() { int i = this.a; if (i >= 0) { int i2 = this.j.get(i); int dataPosition = this.f.dataPosition(); this.f.setDataPosition(i2); this.f.writeInt(dataPosition - i2); this.f.setDataPosition(dataPosition); } } @Override // androidx.versionedparcelable.VersionedParcel public final VersionedParcel c() { Parcel parcel = this.f; int dataPosition = parcel.dataPosition(); int i = this.h; if (i == this.i) { i = this.c; } int i2 = i; StringBuilder sb = new StringBuilder(); sb.append(this.f8476o); sb.append(" "); return new ZCM(parcel, dataPosition, i2, sb.toString(), this.e, this.b, this.d); } @Override // androidx.versionedparcelable.VersionedParcel public final void d(byte[] bArr) { if (bArr != null) { this.f.writeInt(bArr.length); this.f.writeByteArray(bArr); } else { this.f.writeInt(-1); } } @Override // androidx.versionedparcelable.VersionedParcel public final void e(int i) { this.f.writeInt(i); } @Override // androidx.versionedparcelable.VersionedParcel public final void d(String str) { this.f.writeString(str); } @Override // androidx.versionedparcelable.VersionedParcel public final void Cc_(Parcelable parcelable) { this.f.writeParcelable(parcelable, 0); } @Override // androidx.versionedparcelable.VersionedParcel public final void a(boolean z) { this.f.writeInt(z ? 1 : 0); } @Override // androidx.versionedparcelable.VersionedParcel public final void c(CharSequence charSequence) { TextUtils.writeToParcel(charSequence, this.f, 0); } @Override // androidx.versionedparcelable.VersionedParcel public final CharSequence i() { return (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(this.f); } @Override // androidx.versionedparcelable.VersionedParcel public final int j() { return this.f.readInt(); } @Override // androidx.versionedparcelable.VersionedParcel public final String f() { return this.f.readString(); } @Override // androidx.versionedparcelable.VersionedParcel public final byte[] a() { int readInt = this.f.readInt(); if (readInt < 0) { return null; } byte[] bArr = new byte[readInt]; this.f.readByteArray(bArr); return bArr; } @Override // androidx.versionedparcelable.VersionedParcel public final T Cb_() { return (T) this.f.readParcelable(getClass().getClassLoader()); } @Override // androidx.versionedparcelable.VersionedParcel public final boolean b() { return this.f.readInt() != 0; } }