org.yajul.io
Class ByteCountingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.yajul.io.ByteCountingOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class ByteCountingOutputStream
extends java.io.FilterOutputStream

Output stream filter that counts the number of bytes written to the underlying stream.

Author:
Josh

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ByteCountingOutputStream(java.io.OutputStream out)
          Creates a new output stream that counts then number of bytes written to the output stream specified.
 
Method Summary
 int getByteCount()
          Returns the number of bytes written.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.FilterOutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteCountingOutputStream

public ByteCountingOutputStream(java.io.OutputStream out)
Creates a new output stream that counts then number of bytes written to the output stream specified.

Parameters:
out - the output stream
Method Detail

write

public void write(byte[] b)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

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

write

public void write(int b)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

getByteCount

public int getByteCount()
Returns the number of bytes written.

Returns:
the number of bytes written


Copyright © 2008. All Rights Reserved.