|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
rabbit.io.MultiOutputStream
public class MultiOutputStream
A class to handle automatic writing to several streams simultanius.
Field Summary | |
---|---|
static int |
CLOSE_CURRENT
how should exceptions be handled? by closing the stream causing it |
static int |
RESPAWN_EXCEPTION
Or by respawning the exception up |
Constructor Summary | |
---|---|
MultiOutputStream()
Creates a new MultiOutputStream with no connected OutputStreams |
|
MultiOutputStream(java.io.OutputStream os)
Creates a new MultiOutputStream with one connected OutputStream |
Method Summary | |
---|---|
void |
addOutputStream(java.io.OutputStream os)
Connects one more OutputStream. |
void |
close()
Close this stream. |
boolean |
containsStream(java.io.OutputStream os)
Check if a stream is still being written to. |
void |
flush()
Write any pending data. |
java.nio.channels.WritableByteChannel |
getChannel()
Get a writable channel for this stream. |
void |
removeOutputStream(java.io.OutputStream os)
Disconnects one of the underlaying streams. |
void |
setMode(int i)
Sets the mode of this stream. |
void |
write(byte[] b)
Write a byte array to this stream. |
void |
write(byte[] b,
int off,
int len)
Write a byte array to this stream. |
void |
write(int b)
Write a byte to this stream. |
void |
writeHTTPHeader(HTTPHeader header)
Write a HTTPHeader on this stream. |
void |
writeHTTPHeader(HTTPHeader header,
boolean proxyConnected,
java.lang.String proxyAuth)
Write a HTTPHeader on this stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CLOSE_CURRENT
public static final int RESPAWN_EXCEPTION
Constructor Detail |
---|
public MultiOutputStream()
public MultiOutputStream(java.io.OutputStream os)
os
- the OutputStream to connect toMethod Detail |
---|
public void addOutputStream(java.io.OutputStream os)
os
- the new stream to connectpublic void removeOutputStream(java.io.OutputStream os)
os
- the stream to disconnect.public boolean containsStream(java.io.OutputStream os)
os
- the stream to check for.public void setMode(int i)
i
- one of CLOSE_CURRENT(normal) and RESPAWN_EXCEPTION.public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte to write.
java.io.IOException
- if the underlying stream does.public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte array to write.
java.io.IOException
- if the underlying stream does.public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte to write.off
- the starting offset.len
- the number of bytes to write.
java.io.IOException
- if the underlying stream does.public void writeHTTPHeader(HTTPHeader header) throws java.io.IOException
writeHTTPHeader (header, false, null)
header
- the HTTPHeader to write.
java.io.IOException
- if the header could not be written correctly.public void writeHTTPHeader(HTTPHeader header, boolean proxyConnected, java.lang.String proxyAuth) throws java.io.IOException
header
- the HTTPHeader to write.proxyConnected
- true if this connection is connected to another proxy.proxyAuth
- the proxy authentication token to use.
java.io.IOException
- if the header could not be written correctly.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
- if the underlying stream does.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
- if the underlying stream does.public java.nio.channels.WritableByteChannel getChannel()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |