de.infinityloop.util.inout
Class YWayWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
          extended by de.infinityloop.util.inout.YWayWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class YWayWriter
extends java.io.FilterWriter

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


Field Summary
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
YWayWriter(java.io.Writer out)
          Constructor specifying only the underlying ouput stream.
YWayWriter(java.io.Writer out, java.io.Writer yway)
          Constructor specifying the underlying ouput stream and the output stream where incoming data should also be written to.
 
Method Summary
 void close()
          Overrides the corresponding inherited method in FilterWriter.
 void flush()
          Overrides the corresponding inherited method in FilterWriter.
 void write(char[] cbuf, int off, int len)
          Overrides the corresponding inherited method in FilterWriter.
 void write(int c)
          Overrides the corresponding inherited method in FilterWriter.
 void write(java.lang.String str, int off, int len)
          Overrides the corresponding inherited method in FilterWriter.
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YWayWriter

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


YWayWriter

public YWayWriter(java.io.Writer out,
                  java.io.Writer 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(int c)
           throws java.io.IOException
Overrides the corresponding inherited method in FilterWriter.

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

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Overrides the corresponding inherited method in FilterWriter.

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

write

public void write(java.lang.String str,
                  int off,
                  int len)
           throws java.io.IOException
Overrides the corresponding inherited method in FilterWriter.

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

close

public void close()
           throws java.io.IOException
Overrides the corresponding inherited method in FilterWriter.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterWriter
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Overrides the corresponding inherited method in FilterWriter.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.FilterWriter
Throws:
java.io.IOException