|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.OutputStream | +--edu.nmu.io.DelegatedOutputStream
Writes output to another OutputStream
By using delegation as a level of abstraction, applications can change the destination of output without needing to reference a new OutputStream. This is especially useful for changing the source of input for final references such as System.out
It is important to note that this class is not
thread safe. A call to the delegated
OutputStream could forseeably hang while another
Thread calls setStream(OutputStream)
Constructor Summary | |
DelegatedOutputStream(java.io.OutputStream out)
Creates a new DelegatedOutputStream from the specified OutputStream |
Method Summary | |
void |
close()
|
void |
flush()
|
java.io.OutputStream |
getStream()
Gets the OutputStream used for delegation |
void |
setStream(java.io.OutputStream out)
Sets a new OutputStream to be used for delegation |
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DelegatedOutputStream(java.io.OutputStream out)
out
- the OutputStream to which calls should
be delegatedMethod Detail |
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in class java.io.OutputStream
java.io.IOException
public java.io.OutputStream getStream()
public void setStream(java.io.OutputStream out)
out
- the OutputStream to which calls should
be delegated
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |