org.apache.commons.io.output

Class 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.5 2004/02/23 04:40:29 bayard Exp $
Author:
Henri Yandell

Field Summary

private int
count

Fields inherited from class org.apache.commons.io.output.ProxyOutputStream

proxy

Constructor Summary

CountingOutputStream(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, write, write, write

Field Details

count

private int count

Constructor Details

CountingOutputStream

public CountingOutputStream(OutputStream out)
Constructs a CountingOutputStream.
Parameters:
out - the OutputStream to write to

Method Details

getCount

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

write

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

write

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

write

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