|
EAF 7.6 Implementation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.lutris.util.OutputStreamHub
public class OutputStreamHub
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.
OutputStream
Constructor Summary | |
---|---|
OutputStreamHub()
Create a new hub with no members. |
Method Summary | |
---|---|
void |
add(java.io.OutputStream newMember)
Add a new OutputStream to the set. |
void |
close()
Closes the stream. |
boolean |
contains(java.io.OutputStream stream)
Is the given OutputStream currently in the set? |
void |
flush()
Flushes are attempted on all members. |
void |
remove(java.io.OutputStream member)
Remove an OutputStream from the set. |
void |
write(byte[] b)
Write an array of bytes to all the members. |
void |
write(byte[] b,
int off,
int len)
Write part of an array of bytes to all the members. |
void |
write(int b)
Write an integer to all the members. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OutputStreamHub()
Method Detail |
---|
public void add(java.io.OutputStream newMember)
write()
s
happen, the will be coppied to all the current members of the set.
newMember
- The OutputStream to add to the set.OutputStream
public void remove(java.io.OutputStream member)
member
- The OutputStream to remove.OutputStream
public boolean contains(java.io.OutputStream stream)
stream
- The OutputStream to search for.OutputStream
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- The int to write.
java.io.IOException
OutputStream
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
b
- The byte array to write.
java.io.IOException
OutputStream
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
b
- The byte array to write part of.off
- The offset.len
- How many bytes to write.
java.io.IOException
OutputStream
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
OutputStream
public void close() throws java.io.IOException
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.
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
OutputStream
|
EAF 7.6 Implementation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |