package defpackage;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.RandomAccess;

/* JADX INFO: renamed from: ᵣᵛᵤ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC3365 {
    protected transient int zza;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public static void m7711(Iterable iterable, List list) {
        iterable.getClass();
        if (iterable instanceof InterfaceC0544) {
            list.addAll((Collection) iterable);
            return;
        }
        if (iterable instanceof Collection) {
            int size = ((Collection) iterable).size();
            if (list instanceof ArrayList) {
                ((ArrayList) list).ensureCapacity(list.size() + size);
            } else if (list instanceof C5024) {
                C5024 c5024 = (C5024) list;
                int i = c5024.f19045 + size;
                int length = c5024.f19046.length;
                if (i > length) {
                    if (length != 0) {
                        while (length < i) {
                            length = AbstractC0659.m2408(length, 3, 2, 1, 10);
                        }
                        c5024.f19046 = Arrays.copyOf(c5024.f19046, length);
                    } else {
                        c5024.f19046 = new Object[Math.max(i, 10)];
                    }
                }
            }
        }
        int size2 = list.size();
        if (!(iterable instanceof List) || !(iterable instanceof RandomAccess)) {
            for (Object obj : iterable) {
                if (obj == null) {
                    AbstractC4714.m9864(size2, list);
                    throw null;
                }
                list.add(obj);
            }
            return;
        }
        List list2 = (List) iterable;
        int size3 = list2.size();
        for (int i2 = 0; i2 < size3; i2++) {
            Object obj2 = list2.get(i2);
            if (obj2 == null) {
                AbstractC4714.m9864(size2, list);
                throw null;
            }
            list.add(obj2);
        }
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final void m7712(OutputStream outputStream) {
        AbstractC4729 abstractC4729 = (AbstractC4729) this;
        int iM9880 = abstractC4729.m9880();
        boolean z = AbstractC0857.f3798;
        if (iM9880 > 4096) {
            iM9880 = 4096;
        }
        C0525 c0525 = new C0525(outputStream, iM9880);
        abstractC4729.m9886(c0525);
        if (c0525.f2701 > 0) {
            c0525.m2042();
        }
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public abstract int mo7713(InterfaceC0245 interfaceC0245);

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final byte[] m7714() {
        try {
            AbstractC4729 abstractC4729 = (AbstractC4729) this;
            int iM9880 = abstractC4729.m9880();
            byte[] bArr = new byte[iM9880];
            boolean z = AbstractC0857.f3798;
            C3210 c3210 = new C3210(iM9880, bArr);
            abstractC4729.m9886(c3210);
            if (c3210.m7351() > 0) {
                throw new IllegalStateException("Did not write as much data as expected.");
            }
            if (c3210.m7351() >= 0) {
                return bArr;
            }
            throw new IllegalStateException("Wrote more data than expected.");
        } catch (IOException e) {
            String name = getClass().getName();
            ᵷᵝˎ.ᵪᵹᵥᵻ(AbstractC0793.m2864(new StringBuilder(name.length() + 72), "Serializing ", name, " to a byte array threw an IOException (should never happen)."), e);
            return null;
        }
    }
}
