ch.javasoft.io
Class LengthTrackingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by ch.javasoft.io.LengthTrackingOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class LengthTrackingOutputStream
extends OutputStream

The LengthTrackingOutputStream simply pipes the data written to it to an underlying output stream, but tracks the length of the written bytes at the same time.


Constructor Summary
LengthTrackingOutputStream(OutputStream out)
           
 
Method Summary
 int getLength()
           
 void resetLength()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LengthTrackingOutputStream

public LengthTrackingOutputStream(OutputStream out)
Method Detail

resetLength

public void resetLength()

getLength

public int getLength()

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

write

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

write

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