package com.applovin.impl; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; /* loaded from: classes.dex */ public final class y7 { private final ByteArrayOutputStream a; private final DataOutputStream b; public y7() { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(512); this.a = byteArrayOutputStream; this.b = new DataOutputStream(byteArrayOutputStream); } public byte[] a(w7 w7Var) { this.a.reset(); try { a(this.b, w7Var.a); String str = w7Var.b; if (str == null) { str = ""; } a(this.b, str); this.b.writeLong(w7Var.c); this.b.writeLong(w7Var.d); this.b.write(w7Var.f); this.b.flush(); return this.a.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } } private static void a(DataOutputStream dataOutputStream, String str) { dataOutputStream.writeBytes(str); dataOutputStream.writeByte(0); } }