package o; import java.io.ByteArrayOutputStream; import java.io.IOException; /* renamed from: o.yqj, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C17684yqj extends ByteArrayOutputStream { private final UgZ b; public C17684yqj(UgZ ugZ, int i) { this.b = ugZ; ((ByteArrayOutputStream) this).buf = ugZ.c(Math.max(i, 256)); } @Override // java.io.ByteArrayOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable public final void close() throws IOException { this.b.d(((ByteArrayOutputStream) this).buf); ((ByteArrayOutputStream) this).buf = null; super.close(); } public final void finalize() { this.b.d(((ByteArrayOutputStream) this).buf); } private void c(int i) { if (((ByteArrayOutputStream) this).count + i <= ((ByteArrayOutputStream) this).buf.length) { return; } byte[] c = this.b.c((((ByteArrayOutputStream) this).count + i) << 1); System.arraycopy(((ByteArrayOutputStream) this).buf, 0, c, 0, ((ByteArrayOutputStream) this).count); this.b.d(((ByteArrayOutputStream) this).buf); ((ByteArrayOutputStream) this).buf = c; } @Override // java.io.ByteArrayOutputStream, java.io.OutputStream public final void write(byte[] bArr, int i, int i2) { synchronized (this) { c(i2); super.write(bArr, i, i2); } } @Override // java.io.ByteArrayOutputStream, java.io.OutputStream public final void write(int i) { synchronized (this) { c(1); super.write(i); } } }