@Beta public final class CountingOutputStream extends FilterOutputStream
An OutputStream that counts the number of bytes written.
out| Constructor and Description |
|---|
CountingOutputStream(OutputStream out)
Wraps another output stream, counting the number of bytes written.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
getCount()
Returns the number of bytes written.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
flush, writepublic CountingOutputStream(OutputStream out)
Wraps another output stream, counting the number of bytes written.
out - the output stream to be wrappedpublic long getCount()
Returns the number of bytes written.
public void write(byte[] b,
int off,
int len)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOException