package com.google.common.io; import com.google.common.base.Preconditions; import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; @ElementTypesAreNonnullByDefault /* loaded from: classes3.dex */ public final class CountingOutputStream extends FilterOutputStream { private long count; public long getCount() { return this.count; } public CountingOutputStream(OutputStream outputStream) { super((OutputStream) Preconditions.checkNotNull(outputStream)); } @Override // java.io.FilterOutputStream, java.io.OutputStream public void write(byte[] bArr, int i, int i2) throws IOException { this.out.write(bArr, i, i2); this.count += i2; } @Override // java.io.FilterOutputStream, java.io.OutputStream public void write(int i) throws IOException { this.out.write(i); this.count++; } @Override // java.io.FilterOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable public void close() throws IOException { this.out.close(); } }