edu.rice.cs.plt.io
Class OutputStreamSplitter

java.lang.Object
  extended by java.io.OutputStream
      extended by edu.rice.cs.plt.io.DirectOutputStream
          extended by edu.rice.cs.plt.io.OutputStreamSplitter
All Implemented Interfaces:
Composite, java.io.Closeable, java.io.Flushable

public class OutputStreamSplitter
extends DirectOutputStream
implements Composite

An output stream that allows sending the same data to an arbitrary number of streams.


Field Summary
 
Fields inherited from class edu.rice.cs.plt.io.DirectOutputStream
DEFAULT_BUFFER_SIZE
 
Constructor Summary
OutputStreamSplitter(java.lang.Iterable<? extends java.io.OutputStream> streams)
           
OutputStreamSplitter(java.io.OutputStream... streams)
           
 
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(byte[] bytes)
          Delegate to the more general DirectOutputStream.write(byte[], int, int) method
 void write(byte[] bytes, int off, int len)
          Subclasses are, at a minimum, required to implement this method.
 void write(int b)
          Delegate to the more general DirectOutputStream.write(byte[], int, int) method
 
Methods inherited from class edu.rice.cs.plt.io.DirectOutputStream
write, write, write, writeAll, writeAll, writeAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputStreamSplitter

public OutputStreamSplitter(java.io.OutputStream... streams)

OutputStreamSplitter

public OutputStreamSplitter(java.lang.Iterable<? extends java.io.OutputStream> streams)
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
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

flush

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

write

public void write(byte[] bytes)
           throws java.io.IOException
Description copied from class: DirectOutputStream
Delegate to the more general DirectOutputStream.write(byte[], int, int) method

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

write

public void write(byte[] bytes,
                  int off,
                  int len)
           throws java.io.IOException
Description copied from class: DirectOutputStream
Subclasses are, at a minimum, required to implement this method.

Specified by:
write in class DirectOutputStream
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Description copied from class: DirectOutputStream
Delegate to the more general DirectOutputStream.write(byte[], int, int) method

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