Package org.scijava.console
Class MultiOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.scijava.console.MultiOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class MultiOutputStream extends OutputStream
AMultiOutputStreamis a collection of constituentOutputStreamobjects, to which all output is forwarded.Thanks to Ian F. Darwin for his implementation of a similar concept.
- Author:
- Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description MultiOutputStream(OutputStream... os)Forwards output to a list of output streams.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOutputStream(OutputStream os)Adds an output stream to those receiving this stream's output.voidclose()voidflush()voidremoveOutputStream(OutputStream os)Removes an output stream from those receiving this stream's output.voidwrite(byte[] buf, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
write
-
-
-
-
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:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] buf, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
-