64 lines
1.8 KiB
Java
64 lines
1.8 KiB
Java
|
package com.google.android.gms.internal.gtm;
|
||
|
|
||
|
import com.google.android.gms.common.internal.Preconditions;
|
||
|
import java.io.ByteArrayOutputStream;
|
||
|
import java.io.IOException;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class zzcl {
|
||
|
private int zzabs;
|
||
|
private ByteArrayOutputStream zzabt = new ByteArrayOutputStream();
|
||
|
private final zzck zzabu;
|
||
|
|
||
|
public zzcl(zzck zzckVar) {
|
||
|
this.zzabu = zzckVar;
|
||
|
}
|
||
|
|
||
|
public final boolean zze(zzcd zzcdVar) {
|
||
|
byte[] bArr;
|
||
|
Preconditions.checkNotNull(zzcdVar);
|
||
|
if (this.zzabs + 1 > zzbq.zzes()) {
|
||
|
return false;
|
||
|
}
|
||
|
String zza = this.zzabu.zza(zzcdVar, false);
|
||
|
if (zza == null) {
|
||
|
this.zzabu.zzco().zza(zzcdVar, "Error formatting hit");
|
||
|
return true;
|
||
|
}
|
||
|
byte[] bytes = zza.getBytes();
|
||
|
int length = bytes.length;
|
||
|
if (length > zzbq.zzeo()) {
|
||
|
this.zzabu.zzco().zza(zzcdVar, "Hit size exceeds the maximum size limit");
|
||
|
return true;
|
||
|
}
|
||
|
if (this.zzabt.size() > 0) {
|
||
|
length++;
|
||
|
}
|
||
|
if (this.zzabt.size() + length > zzby.zzzz.get().intValue()) {
|
||
|
return false;
|
||
|
}
|
||
|
try {
|
||
|
if (this.zzabt.size() > 0) {
|
||
|
ByteArrayOutputStream byteArrayOutputStream = this.zzabt;
|
||
|
bArr = zzck.zzabr;
|
||
|
byteArrayOutputStream.write(bArr);
|
||
|
}
|
||
|
this.zzabt.write(bytes);
|
||
|
this.zzabs++;
|
||
|
return true;
|
||
|
} catch (IOException e) {
|
||
|
this.zzabu.zze("Failed to write payload when batching hits", e);
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final byte[] getPayload() {
|
||
|
return this.zzabt.toByteArray();
|
||
|
}
|
||
|
|
||
|
public final int zzfu() {
|
||
|
return this.zzabs;
|
||
|
}
|
||
|
}
|