Class EDU.gac.max.io.MulticastOutputStream
All Packages Class Hierarchy This Package Previous Next Index
Class EDU.gac.max.io.MulticastOutputStream
java.lang.Object
|
+----java.io.OutputStream
|
+----EDU.gac.max.io.MulticastOutputStream
- public class MulticastOutputStream
- extends OutputStream
The MulticastOutputStream class is used to provide a single stream
that encapsulates arbitrarily many constituent streams such that writing
to the one MulticastOutputStream effectively writes to all of the
constituent streams. A simple example of how this could be used would
be to arrange to have messages automatically go both to a log file
and to the console.
Efficiency note: the representation chosen for
MulticastOutputStream was selected based on the
assumption that either the number of constituent
streams will be small or the remove method will
be infrequently used.
Written 17 Aug 1996 by
Max Hailperin
<max@gac.edu>
-
MulticastOutputStream()
-
-
add(OutputStream)
- The add method adds another constituent stream
to receive all output hencforth sent to the MulticastOutputStream
(until the constituent stream is removed).
-
close()
-
-
flush()
-
-
remove(OutputStream)
- The remove method disconnects one of the constituent streams,
so that output to the MulticastOutputStream no longer goes there.
-
write(byte[])
-
-
write(byte[], int, int)
-
-
write(int)
-
MulticastOutputStream
public MulticastOutputStream()
add
public synchronized void add(OutputStream newOut)
- The add method adds another constituent stream
to receive all output hencforth sent to the MulticastOutputStream
(until the constituent stream is removed). This is the only
way the MulticastOutputStream comes to do anything useful,
because when created there are no constituent streams.
It is undefined what will happen if a stream that is already
one of the constituent streams is added a second time.
remove
public synchronized void remove(OutputStream oldOut)
- The remove method disconnects one of the constituent streams,
so that output to the MulticastOutputStream no longer goes there.
The removed stream is not closed, however, and thus can still be
separately written to or later added back in. It is undefined
what happens if the stream is not one of the constituent streams
close
public synchronized void close() throws IOException
- Overrides:
- close in class OutputStream
flush
public synchronized void flush() throws IOException
- Overrides:
- flush in class OutputStream
write
public synchronized void write(byte b[]) throws IOException
- Overrides:
- write in class OutputStream
write
public synchronized void write(byte b[],
int off,
int len) throws IOException
- Overrides:
- write in class OutputStream
write
public synchronized void write(int b) throws IOException
- Overrides:
- write in class OutputStream
All Packages Class Hierarchy This Package Previous Next Index