package i;

import d.C0422b;
import g.C0474a;
import java.lang.reflect.Type;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicLongArray;

/* JADX INFO: renamed from: i.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0527g implements U, h.t {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final C0527g f4361a = new C0527g();

    @Override // i.U
    public void a(C0516I c0516i, Object obj, Object obj2, Type type, int i2) {
        e0 e0Var = c0516i.f4223k;
        if (obj instanceof AtomicInteger) {
            e0Var.G(((AtomicInteger) obj).get());
            return;
        }
        if (obj instanceof AtomicLong) {
            e0Var.I(((AtomicLong) obj).get());
            return;
        }
        if (obj instanceof AtomicBoolean) {
            e0Var.append(((AtomicBoolean) obj).get() ? "true" : "false");
            return;
        }
        if (obj == null) {
            e0Var.N(f0.WriteNullListAsEmpty);
            return;
        }
        int i3 = 0;
        if (obj instanceof AtomicIntegerArray) {
            AtomicIntegerArray atomicIntegerArray = (AtomicIntegerArray) obj;
            int length = atomicIntegerArray.length();
            e0Var.write(91);
            while (i3 < length) {
                int i4 = atomicIntegerArray.get(i3);
                if (i3 != 0) {
                    e0Var.write(44);
                }
                e0Var.G(i4);
                i3++;
            }
            e0Var.write(93);
            return;
        }
        AtomicLongArray atomicLongArray = (AtomicLongArray) obj;
        int length2 = atomicLongArray.length();
        e0Var.write(91);
        while (i3 < length2) {
            long j2 = atomicLongArray.get(i3);
            if (i3 != 0) {
                e0Var.write(44);
            }
            e0Var.I(j2);
            i3++;
        }
        e0Var.write(93);
    }

    @Override // h.t
    public Object b(C0474a c0474a, Type type, Object obj) {
        if (c0474a.f3944H.F() == 8) {
            c0474a.f3944H.s(16);
            return null;
        }
        C0422b c0422b = new C0422b();
        c0474a.H(c0422b);
        int i2 = 0;
        if (type == AtomicIntegerArray.class) {
            AtomicIntegerArray atomicIntegerArray = new AtomicIntegerArray(c0422b.size());
            while (i2 < c0422b.size()) {
                atomicIntegerArray.set(i2, c0422b.s(i2).intValue());
                i2++;
            }
            return atomicIntegerArray;
        }
        AtomicLongArray atomicLongArray = new AtomicLongArray(c0422b.size());
        while (i2 < c0422b.size()) {
            atomicLongArray.set(i2, c0422b.t(i2).longValue());
            i2++;
        }
        return atomicLongArray;
    }

    @Override // h.t
    public int d() {
        return 14;
    }
}
