com.github.akurilov.commons.io.ByteCountOutputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-commons Show documentation
Show all versions of java-commons Show documentation
Common functionality Java library
The newest version!
package com.github.akurilov.commons.io;
import java.io.OutputStream;
import java.util.concurrent.atomic.LongAdder;
public class ByteCountOutputStream
extends OutputStream {
protected final LongAdder byteCount = new LongAdder();
public final long byteCount() {
return byteCount.sum();
}
@Override
public void write(final int b) {
byteCount.increment();
}
@Override
public void write(final byte buff[], final int off, final int len) {
byteCount.add(len);
}
@Override
public void write(final byte buff[]) {
byteCount.add(buff.length);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy