| java.lang.Object java.io.OutputStream com.lutris.util.OutputStreamHub
OutputStreamHub | public class OutputStreamHub extends OutputStream (Code) | | This class implements a "hub", or redistribution center.
Like a "Y" connector for garden hoses, but with an arbitrary
number of outputs, not just 2.
Instances of this class maintain teir own set of OutputStreams.
When you create an instance of this class, the set is empty.
Writes to the hub have no effect. call add() to
register OutputStreams with the hub. All OutputStream calls are
routed to all the current members of the set.
See Also: java.io.OutputStream author: Andy John |
Constructor Summary | |
public | OutputStreamHub() Create a new hub with no members. |
Method Summary | |
public void | add(OutputStream newMember) Add a new OutputStream to the set. | public void | close() Closes the stream. | public boolean | contains(OutputStream stream) | public void | flush() Flushes are attempted on all members. | public void | remove(OutputStream member) Remove an OutputStream from the set. | public void | write(int b) Write an integer to all the members. | public void | write(byte b) Write an array of bytes to all the members. | public void | write(byte b, int off, int len) Write part of an array of bytes to all the members. |
OutputStreamHub | public OutputStreamHub()(Code) | | Create a new hub with no members.
|
add | public void add(OutputStream newMember)(Code) | | Add a new OutputStream to the set. When write() s
happen, the will be coppied to all the current members of the set.
Parameters: newMember - The OutputStream to add to the set. See Also: java.io.OutputStream |
close | public void close() throws IOException(Code) | | Closes the stream. Do not call write() after this.
Calls close() on all member OutputStreams.
The last exception thrown, if there are more than
one, will be thown from this method.
See Also: java.io.OutputStream |
flush | public void flush() throws IOException(Code) | | Flushes are attempted on all members.
The last exception thrown, if there are more than
one, will be thown from this method.
See Also: java.io.OutputStream |
write | public void write(int b) throws IOException(Code) | | Write an integer to all the members. Writes are attempted on all
members. The last exception thrown, if there are more than
one, will be thown from this method.
Parameters: b - The int to write. See Also: java.io.OutputStream |
write | public void write(byte b) throws IOException(Code) | | Write an array of bytes to all the members.
Writes are attempted on all
members. The last exception thrown, if there are more than
one, will be thown from this method.
Parameters: b - The byte array to write. See Also: java.io.OutputStream |
write | public void write(byte b, int off, int len) throws IOException(Code) | | Write part of an array of bytes to all the members.
Bytes b[off]..b[off+len-1] will be written.
Writes are attempted on all
members. The last exception thrown, if there are more than
one, will be thown from this method.
Parameters: b - The byte array to write part of. Parameters: off - The offset. Parameters: len - How many bytes to write. See Also: java.io.OutputStream |
|
|