package com.google.android.gms.internal.pal;

import java.io.IOException;

/* JADX INFO: loaded from: classes2.dex */
public abstract class b0 extends h {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final d0 f20698a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public d0 f20699b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f20700c = false;

    public b0(d0 d0Var) {
        this.f20698a = d0Var;
        this.f20699b = (d0) d0Var.m(4);
    }

    public static final void d(d0 d0Var, d0 d0Var2) {
        g1.f20921c.a(d0Var.getClass()).zzg(d0Var, d0Var2);
    }

    @Override // com.google.android.gms.internal.pal.a1
    public final /* synthetic */ d0 a() {
        return this.f20698a;
    }

    public final Object clone() {
        b0 b0Var = (b0) this.f20698a.m(5);
        b0Var.e(h());
        return b0Var;
    }

    public final void e(d0 d0Var) {
        if (this.f20700c) {
            i();
            this.f20700c = false;
        }
        d(this.f20699b, d0Var);
    }

    public final void f(byte[] bArr, int i10, w wVar) throws zzadi {
        if (this.f20700c) {
            i();
            this.f20700c = false;
        }
        try {
            g1.f20921c.a(this.f20699b.getClass()).c(this.f20699b, bArr, 0, i10, new com.google.android.gms.internal.ads.vc(wVar));
        } catch (zzadi e10) {
            throw e10;
        } catch (IOException e11) {
            throw new RuntimeException("Reading from byte array should not throw IOException.", e11);
        } catch (IndexOutOfBoundsException unused) {
            throw zzadi.f();
        }
    }

    public final d0 g() {
        d0 d0VarH = h();
        if (d0VarH.g()) {
            return d0VarH;
        }
        throw new zzafh();
    }

    public final d0 h() {
        if (this.f20700c) {
            return this.f20699b;
        }
        d0 d0Var = this.f20699b;
        g1.f20921c.a(d0Var.getClass()).zzf(d0Var);
        this.f20700c = true;
        return this.f20699b;
    }

    public final void i() {
        d0 d0Var = (d0) this.f20699b.m(4);
        d(d0Var, this.f20699b);
        this.f20699b = d0Var;
    }
}
