public final class CountingOutputStream extends OutputStream
OutputStream that counts the number of bytes that have
been written to its underlying stream.| Constructor and Description |
|---|
CountingOutputStream(OutputStream out)
Creates a new
CountingOutputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
long |
getCount()
Returns the number of bytes that have been written to the underlying
stream so far.
|
long |
resetCount()
Sets the counter to 0 and returns its value before resetting it.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int i) |
public CountingOutputStream(OutputStream out)
CountingOutputStream.out - the underlying stream.NullPointerException - if out is null.public long getCount()
public long resetCount()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void write(int i)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionCopyright © 2012–2015. All rights reserved.