org.apache.commons.io.output
Class CountingOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byorg.apache.commons.io.output.ProxyOutputStream
              extended byorg.apache.commons.io.output.CountingOutputStream

public class CountingOutputStream
extends ProxyOutputStream

Used in debugging, it counts the number of bytes that pass through it.

Version:
$Id: CountingOutputStream.java,v 1.4 2003/10/13 07:04:31 rdonkin Exp $
Author:
Henri Yandell

Field Summary
private  int count
           
 
Fields inherited from class org.apache.commons.io.output.ProxyOutputStream
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
CountingOutputStream(java.io.OutputStream out)
          Constructs a CountingOutputStream.
 
Method Summary
 int getCount()
          The number of bytes that have passed through this stream.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class org.apache.commons.io.output.ProxyOutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

private int count
Constructor Detail

CountingOutputStream

public CountingOutputStream(java.io.OutputStream out)
Constructs a CountingOutputStream.

Parameters:
out - the OutputStream to write to
Method Detail

write

public void write(byte[] b)
           throws java.io.IOException
Overrides:
write in class ProxyOutputStream
Throws:
java.io.IOException
See Also:
OutputStream.write(byte[])

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class ProxyOutputStream
Throws:
java.io.IOException
See Also:
OutputStream.write(byte[], int, int)

write

public void write(int b)
           throws java.io.IOException
Overrides:
write in class ProxyOutputStream
Throws:
java.io.IOException
See Also:
OutputStream.write(int)

getCount

public int getCount()
The number of bytes that have passed through this stream.

Returns:
the number of bytes accumulated