package com.google.android.gms.internal.firebase_ml; import java.io.IOException; import java.lang.reflect.Field; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Iterator; import java.util.Map; /* loaded from: classes2.dex */ public abstract class zzgf { public abstract void flush() throws IOException; public abstract void writeBoolean(boolean z) throws IOException; public abstract void writeString(String str) throws IOException; public abstract void zza(double d) throws IOException; public abstract void zza(BigDecimal bigDecimal) throws IOException; public abstract void zza(BigInteger bigInteger) throws IOException; public abstract void zzad(int i) throws IOException; public abstract void zzan(String str) throws IOException; public abstract void zzfy() throws IOException; public abstract void zzfz() throws IOException; public abstract void zzg(long j) throws IOException; public abstract void zzga() throws IOException; public abstract void zzgb() throws IOException; public abstract void zzgc() throws IOException; public void zzgd() throws IOException { } public abstract void zzl(float f) throws IOException; public final void zzd(Object obj) throws IOException { zza(false, obj); } private final void zza(boolean z, Object obj) throws IOException { boolean z2; if (obj == null) { return; } Class cls = obj.getClass(); if (zzhf.isNull(obj)) { zzgc(); return; } if (obj instanceof String) { writeString((String) obj); return; } boolean z3 = false; if (obj instanceof Number) { if (z) { writeString(obj.toString()); return; } if (obj instanceof BigDecimal) { zza((BigDecimal) obj); return; } if (obj instanceof BigInteger) { zza((BigInteger) obj); return; } if (obj instanceof Long) { zzg(((Long) obj).longValue()); return; } if (obj instanceof Float) { float floatValue = ((Number) obj).floatValue(); if (!Float.isInfinite(floatValue) && !Float.isNaN(floatValue)) { z3 = true; } zzks.checkArgument(z3); zzl(floatValue); return; } if ((obj instanceof Integer) || (obj instanceof Short) || (obj instanceof Byte)) { zzad(((Number) obj).intValue()); return; } double doubleValue = ((Number) obj).doubleValue(); if (!Double.isInfinite(doubleValue) && !Double.isNaN(doubleValue)) { z3 = true; } zzks.checkArgument(z3); zza(doubleValue); return; } if (obj instanceof Boolean) { writeBoolean(((Boolean) obj).booleanValue()); return; } if (obj instanceof zzhk) { writeString(((zzhk) obj).zzhe()); return; } if ((obj instanceof Iterable) || cls.isArray()) { zzfy(); Iterator it = zzia.zzi(obj).iterator(); while (it.hasNext()) { zza(z, it.next()); } zzfz(); return; } if (cls.isEnum()) { String name = zzhl.zza((Enum) obj).getName(); if (name == null) { zzgc(); return; } else { writeString(name); return; } } zzga(); boolean z4 = (obj instanceof Map) && !(obj instanceof zzhm); zzhd zzc = z4 ? null : zzhd.zzc(cls); for (Map.Entry entry : zzhf.zzf(obj).entrySet()) { Object value = entry.getValue(); if (value != null) { String key = entry.getKey(); if (z4) { z2 = z; } else { zzhl zzao = zzc.zzao(key); Field zzhf = zzao == null ? null : zzao.zzhf(); z2 = (zzhf == null || zzhf.getAnnotation(zzgl.class) == null) ? false : true; } zzan(key); zza(z2, value); } } zzgb(); } }