org.scijava.console
Class MultiOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.scijava.console.MultiOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class MultiOutputStream
extends OutputStream

A MultiOutputStream is a collection of constituent OutputStream objects, to which all output is forwarded.

Thanks to Ian F. Darwin for his implementation of a similar concept.

Author:
Curtis Rueden

Constructor Summary
MultiOutputStream(OutputStream... os)
          Forwards output to a list of output streams.
 
Method Summary
 void addOutputStream(OutputStream os)
          Adds an output stream to those receiving this stream's output.
 void close()
           
 void flush()
           
 void removeOutputStream(OutputStream os)
          Removes an output stream from those receiving this stream's output.
 void write(byte[] buf, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiOutputStream

public MultiOutputStream(OutputStream... os)
Forwards output to a list of output streams.

Parameters:
os - Output streams which will receive this stream's output.
Method Detail

addOutputStream

public void addOutputStream(OutputStream os)
Adds an output stream to those receiving this stream's output.


removeOutputStream

public void removeOutputStream(OutputStream os)
Removes an output stream from those receiving this stream's output.


write

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

write

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

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

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


Copyright © 2009–2015 SciJava. All rights reserved.