de.infinityloop.util.inout
Class YWayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by de.infinityloop.util.inout.YWayOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class YWayOutputStream
extends java.io.FilterOutputStream

This class provides a Y-Way splitter for an output stream, i.e. the incoming data is output to the default output stream as well as it is duplicated to a settable, second output stream, effectively cloning incoming data sent to this single output stream into two output streams.


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
YWayOutputStream(java.io.OutputStream out)
          Constructor specifying only the underlying ouput stream.
YWayOutputStream(java.io.OutputStream out, java.io.OutputStream yway)
          Constructor specifying the underlying ouput stream and the output stream where incoming data should also be written to.
 
Method Summary
 void write(byte[] b)
          Overrides the corresponding inherited method in FilterOutputStream.
 void write(byte[] b, int off, int len)
          Overrides the corresponding inherited method in FilterOutputStream.
 void write(int b)
          Overrides the corresponding inherited method in FilterOutputStream.
 
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

YWayOutputStream

public YWayOutputStream(java.io.OutputStream out)
Constructor specifying only the underlying ouput stream. Use this when you do not want splitting behaviour.


YWayOutputStream

public YWayOutputStream(java.io.OutputStream out,
                        java.io.OutputStream yway)
Constructor specifying the underlying ouput stream and the output stream where incoming data should also be written to.

Method Detail

write

public void write(byte[] b)
           throws java.io.IOException
Overrides the corresponding inherited method in FilterOutputStream.

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 the corresponding inherited method in FilterOutputStream.

Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Overrides the corresponding inherited method in FilterOutputStream.

Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException