public class CountingOutputStream extends FilterOutputStream
out| Constructor and Description |
|---|
CountingOutputStream(OutputStream out)Create a CountingOutputStream wrapping the given output stream. |
| Modifier and Type | Method and Description |
|---|---|
long | getWritten()Get the total number of bytes written so far. |
void | write(byte[] src,
int off,
int len)Write bytes from a buffer and count them. |
void | write(int val)Write a single byte and count it. |
close, flush, writepublic CountingOutputStream(OutputStream out)
out - the underlying output streampublic long getWritten()
public void write(byte[] src,
int off,
int len)
throws IOExceptionwrite in class FilterOutputStreamsrc - the buffer to write fromoff - the start offset in the bufferlen - the number of bytes to writeIOException - on I/O errorpublic void write(int val)
throws IOExceptionwrite in class FilterOutputStreamval - the byte to writeIOException - on I/O error