com.sap.it.commons.io.CountingOutputStream Maven / Gradle / Ivy
package com.sap.it.commons.io;
import java.io.IOException;
import java.io.OutputStream;
public class CountingOutputStream extends OutputStreamDelegator {
private int writeCount = 0;
public CountingOutputStream(OutputStream outputStream) {
super(outputStream);
}
@Override
public void write(int b) throws IOException {
super.write(b);
writeCount += 1;
}
@Override
public void write(byte[] b) throws IOException {
super.write(b);
writeCount += b.length;
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
super.write(b, off, len);
writeCount += len;
}
public int getCount() {
return writeCount;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy