edu.rice.cs.plt.io
Class WriterSplitter

java.lang.Object
  extended by java.io.Writer
      extended by edu.rice.cs.plt.io.DirectWriter
          extended by edu.rice.cs.plt.io.WriterSplitter
All Implemented Interfaces:
Composite, java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class WriterSplitter
extends DirectWriter
implements Composite

A writer that allows sending the same data to an arbitrary number of writers.


Field Summary
 
Fields inherited from class edu.rice.cs.plt.io.DirectWriter
DEFAULT_BUFFER_SIZE
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
WriterSplitter(java.lang.Iterable<? extends java.io.Writer> writers)
           
WriterSplitter(java.io.Writer... writers)
           
 
Method Summary
 void close()
           
 int compositeHeight()
          Get the maximum path length from this node to a leaf.
 int compositeSize()
          Get the number of nodes in the tree rooted at this node.
 void flush()
           
 void write(char[] cbuf)
           
 void write(char[] cbuf, int off, int len)
           
 void write(int c)
           
 void write(java.lang.String s)
           
 void write(java.lang.String s, int off, int len)
           
 
Methods inherited from class edu.rice.cs.plt.io.DirectWriter
write, write, write, writeAll, writeAll, writeAll
 
Methods inherited from class java.io.Writer
append, append, append
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriterSplitter

public WriterSplitter(java.io.Writer... writers)

WriterSplitter

public WriterSplitter(java.lang.Iterable<? extends java.io.Writer> writers)
Method Detail

compositeHeight

public int compositeHeight()
Description copied from interface: Composite
Get the maximum path length from this node to a leaf.

Specified by:
compositeHeight in interface Composite

compositeSize

public int compositeSize()
Description copied from interface: Composite
Get the number of nodes in the tree rooted at this node. Always 1 or greater.

Specified by:
compositeSize in interface Composite

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

write

public void write(char[] cbuf)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in class java.io.Writer
Throws:
java.io.IOException

write

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

write

public void write(java.lang.String s)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(java.lang.String s,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.Writer
Throws:
java.io.IOException