Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rabbit.io
Class MultiOutputStream

    java.lang.Object
      java.io.OutputStream
          rabbit.io.MultiOutputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable

    public class MultiOutputStream

extends java.io.OutputStream

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

### CLOSE_CURRENT

    public static final int CLOSE_CURRENT

  how should exceptions be handled? by closing the stream causing it

  See Also:
    Constant Field Values

### RESPAWN_EXCEPTION

    public static final int RESPAWN_EXCEPTION

  Or by respawning the exception up

  See Also:
    Constant Field Values

Constructor Detail

### MultiOutputStream

    public MultiOutputStream()

  Creates a new MultiOutputStream with no connected OutputStreams

### MultiOutputStream

    public MultiOutputStream(java.io.OutputStream os)

  Creates a new MultiOutputStream with one connected OutputStream

  Parameters:
    `os` - the OutputStream to connect to

Method Detail

### addOutputStream

    public void addOutputStream(java.io.OutputStream os)

  Connects one more OutputStream.

  Parameters:
    `os` - the new stream to connect

### removeOutputStream

    public void removeOutputStream(java.io.OutputStream os)

  Disconnects one of the underlaying streams.

  Parameters:
    `os` - the stream to disconnect.

### containsStream

    public boolean containsStream(java.io.OutputStream os)

  Check if a stream is still being written to.

  Parameters:
    `os` - the stream to check for.

### setMode

    public void setMode(int i)

  Sets the mode of this stream.

  Parameters:
    `i` - one of CLOSE_CURRENT(normal) and RESPAWN_EXCEPTION.

### write

    public void write(int b)
               throws java.io.IOException

  Write a byte to this stream.

  Specified by:
    `write` in class `java.io.OutputStream`
  Parameters:
    `b` - the byte to write.
  Throws:
    `java.io.IOException` - if the underlying stream does.

### write

    public void write(byte[] b)
               throws java.io.IOException

  Write a byte array to this stream.

  Overrides:
    `write` in class `java.io.OutputStream`
  Parameters:
    `b` - the byte array to write.
  Throws:
    `java.io.IOException` - if the underlying stream does.

### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException

  Write a byte array to this stream.

  Overrides:
    `write` in class `java.io.OutputStream`
  Parameters:
    `b` - the byte to write.
    `off` - the starting offset.
    `len` - the number of bytes to write.
  Throws:
    `java.io.IOException` - if the underlying stream does.

### writeHTTPHeader

    public void writeHTTPHeader(HTTPHeader header)
                         throws java.io.IOException

  Write a HTTPHeader on this stream. This is the same as `writeHTTPHeader (header, false, null)`

  Parameters:
    `header` - the HTTPHeader to write.
  Throws:
    `java.io.IOException` - if the header could not be written correctly.

### writeHTTPHeader

    public void writeHTTPHeader(HTTPHeader header,
                                boolean proxyConnected,
                                java.lang.String proxyAuth)
                         throws java.io.IOException

  Write a HTTPHeader on this stream.

  Parameters:
    `header` - the HTTPHeader to write.
    `proxyConnected` - true if this connection is connected to another proxy.
    `proxyAuth` - the proxy authentication token to use.
  Throws:
    `java.io.IOException` - if the header could not be written correctly.

### flush

    public void flush()
               throws java.io.IOException

  Write any pending data.

  Specified by:
    `flush` in interface `java.io.Flushable`
  Overrides:
    `flush` in class `java.io.OutputStream`
  Throws:
    `java.io.IOException` - if the underlying stream does.

### close

    public void close()
               throws java.io.IOException

  Close this stream.

  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.OutputStream`
  Throws:
    `java.io.IOException` - if the underlying stream does.

### getChannel

    public java.nio.channels.WritableByteChannel getChannel()

  Get a writable channel for this stream.

  Returns:
    a channel or null if channel support is not available.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD