package com.google.android.gms.common.data; import android.content.ContentValues; import android.os.Parcel; import android.os.Parcelable; import com.google.android.gms.common.data.DataHolder; import com.google.android.gms.common.internal.Preconditions; import com.google.android.gms.common.internal.safeparcel.SafeParcelable; /* loaded from: classes.dex */ public class DataBufferSafeParcelable extends AbstractDataBuffer { private static final String[] zaa = {"data"}; private final Parcelable.Creator zab; public DataBufferSafeParcelable(DataHolder dataHolder, Parcelable.Creator creator) { super(dataHolder); this.zab = creator; } public static void addValue(DataHolder.Builder builder, T t) { Parcel obtain = Parcel.obtain(); t.writeToParcel(obtain, 0); ContentValues contentValues = new ContentValues(); contentValues.put("data", obtain.marshall()); builder.withRow(contentValues); obtain.recycle(); } public static DataHolder.Builder buildDataHolder() { return DataHolder.builder(zaa); } @Override // com.google.android.gms.common.data.AbstractDataBuffer, com.google.android.gms.common.data.DataBuffer public T get(int i) { DataHolder dataHolder = (DataHolder) Preconditions.checkNotNull(this.mDataHolder); byte[] byteArray = dataHolder.getByteArray("data", i, dataHolder.getWindowIndex(i)); Parcel obtain = Parcel.obtain(); obtain.unmarshall(byteArray, 0, byteArray.length); obtain.setDataPosition(0); T createFromParcel = this.zab.createFromParcel(obtain); obtain.recycle(); return createFromParcel; } }