package o; import com.google.common.base.Preconditions; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.text.NumberFormat; import java.util.logging.Logger; /* loaded from: classes2.dex */ public class vqe extends ByteArrayOutputStream { private final int a; private final Logger b; private int c; private boolean e; @Override // java.io.ByteArrayOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable public void close() throws IOException { int i; synchronized (this) { if (!this.e) { int i2 = this.c; if (i2 != 0) { if (i2 != 1) { NumberFormat.getInstance().format(i2); } if (((ByteArrayOutputStream) this).count != 0 && ((ByteArrayOutputStream) this).count < this.c && (i = ((ByteArrayOutputStream) this).count) != 1) { NumberFormat.getInstance().format(i); } throw new NullPointerException(); } this.e = true; } } } @Override // java.io.ByteArrayOutputStream, java.io.OutputStream public void write(int i) { synchronized (this) { Preconditions.checkArgument(!this.e); this.c++; if (((ByteArrayOutputStream) this).count < this.a) { super.write(i); } } } @Override // java.io.ByteArrayOutputStream, java.io.OutputStream public void write(byte[] bArr, int i, int i2) { synchronized (this) { Preconditions.checkArgument(!this.e); this.c += i2; if (((ByteArrayOutputStream) this).count < this.a) { int i3 = ((ByteArrayOutputStream) this).count + i2; if (i3 > 0) { i2 += 0 - i3; } super.write(bArr, i, i2); } } } }