package com.google.android.gms.internal.ads; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; /* loaded from: classes3.dex */ public final class zzafl { private final ByteArrayOutputStream zza; private final DataOutputStream zzb; public zzafl() { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(512); this.zza = byteArrayOutputStream; this.zzb = new DataOutputStream(byteArrayOutputStream); } private static void zzb(DataOutputStream dataOutputStream, String str) throws IOException { dataOutputStream.writeBytes(str); dataOutputStream.writeByte(0); } public final byte[] zza(zzafk zzafkVar) { this.zza.reset(); try { zzb(this.zzb, zzafkVar.zza); String str = zzafkVar.zzb; if (str == null) { str = ""; } zzb(this.zzb, str); this.zzb.writeLong(zzafkVar.zzc); this.zzb.writeLong(zzafkVar.zzd); this.zzb.write(zzafkVar.zze); this.zzb.flush(); return this.zza.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } } }