org.entityfs.support.io
Class CountingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.entityfs.support.io.OutputStreamProxy
          extended by org.entityfs.support.io.CountingOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class CountingOutputStream
extends OutputStreamProxy

This OutputStream wraps another OutputStream and counts the number of bytes that are written to it.

Since:
1.1
Author:
Karl Gustafsson
See Also:
CountingInputStream

Constructor Summary
CountingOutputStream(OutputStream wrapped)
           
 
Method Summary
 long getNoOfBytesWritten()
          Get the number of bytes that have been written to the wrapped OutputStream.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class org.entityfs.support.io.OutputStreamProxy
close, flush, getProxied, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CountingOutputStream

public CountingOutputStream(OutputStream wrapped)
Method Detail

write

public void write(int b)
           throws IOException
Overrides:
write in class OutputStreamProxy
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStreamProxy
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStreamProxy
Throws:
IOException

getNoOfBytesWritten

public long getNoOfBytesWritten()
Get the number of bytes that have been written to the wrapped OutputStream.

Returns:
The number of bytes that have been written to the wrapped stream.