what-the-bank/sources/com/google/common/io/CountingOutputStream.java

37 lines
1.1 KiB
Java

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