com.ibm.wbi.util
Class ByteBridge

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--com.ibm.wbi.util.ByteBridge

public class ByteBridge
extends java.io.OutputStream

A store that can act as a middle man between streaming output and reading that input. The input will block appropriately until data is available. The data inside the bridge is not discarded until the ByteBridge itself is discarded.


Constructor Summary
ByteBridge()
          Constructs a new empty ByteBridge to stream data.
 
Method Summary
 void close()
          Close the data buffer to writing.
 void flush()
          Flush the output stream to the input stream reader.
 java.io.InputStream getReader()
          Get the streamed data reader.
 int getSize()
          Get the size of the buffer.
 java.io.OutputStream getWriter()
          Get the streamed data writer.
protected  boolean isDone()
          Determine if the writer is complete.
 void write(byte[] bytes)
          Write an array of bytes to the output stream.
 void write(byte[] bytes, int offset, int length)
          Write a portion of an array of bytes to the output stream.
 void write(int byt)
          Write a byte to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBridge

public ByteBridge()
Constructs a new empty ByteBridge to stream data.
Method Detail

getReader

public java.io.InputStream getReader()
Get the streamed data reader.
Returns:
The reader.

getWriter

public java.io.OutputStream getWriter()
Get the streamed data writer.
Returns:
The writer.

close

public void close()
           throws java.io.IOException
Close the data buffer to writing.
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - If an error occurs.

flush

public void flush()
           throws java.io.IOException
Flush the output stream to the input stream reader.
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - If an error occurs.

write

public void write(int byt)
Write a byte to the output stream.
Overrides:
write in class java.io.OutputStream
Parameters:
byt - The byte.

write

public void write(byte[] bytes)
Write an array of bytes to the output stream.
Overrides:
write in class java.io.OutputStream
Parameters:
bytes - The byte array.

write

public void write(byte[] bytes,
                  int offset,
                  int length)
Write a portion of an array of bytes to the output stream.
Overrides:
write in class java.io.OutputStream
Parameters:
bytes - The byte array.
offset - The index in the array to start.
length - The amount of bytes from the offset to write.

getSize

public int getSize()
Get the size of the buffer. return The buffer size.

isDone

protected boolean isDone()
Determine if the writer is complete.
Returns:
true if write has called close().