MultiOutputStream

public class MultiOutputStream extends OutputStream

OutputStream "Multiplexer" which delegates to a list of other registered OutputStreams.

It's kinda like UNIX "tee". Forwarding is in the order the delegates are added. The implementation is synchronous, so the added OutputStreams should be "fast" in order not to block each other.

Exceptions thrown by added OutputStreams are handled gracefully: They at first do not prevent delegating to the other registered OutputStreams, but then are rethrown after we've pushed to delegates (possibly containing multiple causes).

Author

Michael Vorburger

Constructors

Link copied to clipboard
public void MultiOutputStream()
Creates an empty MultiOutputStream with no delegate streams.
public void MultiOutputStream(Array<OutputStream> delegates)
Creates a MultiOutputStream that delegates to the given OutputStreams.

Functions

Link copied to clipboard
public synchronized MultiOutputStream addOutputStream(OutputStream delegate)
Adds an OutputStream to this multiplexer.
Link copied to clipboard
public void close()
Link copied to clipboard
public void flush()
Link copied to clipboard
Link copied to clipboard
public synchronized MultiOutputStream removeOutputStream(OutputStream delegate)
Removes an OutputStream from this multiplexer.
Link copied to clipboard
public void write(Array<byte> b)
public void write(int b)
public void write(Array<byte> b, int off, int len)