Rabbit-R1/switch port/java/sources/com/google/common/io/CountingOutputStream.java

38 lines
1.1 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
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();
}
}