com.ibm.wbi
Class MegOutputStream

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

public abstract class MegOutputStream
extends java.io.OutputStream

The OutputStream used by a Meg to write streamed request data. The RequestInfo object is cloned and the next Meg is dispatched when the first write() call is made. The RequestInfo must be modified before then to have an affect on the rules engine.


Constructor Summary
MegOutputStream()
          Constructs a new MegOutputStream.
 
Method Summary
abstract  void close()
          Close the meg output stream.
abstract  void flush()
          Flush the output stream.
abstract  ByteStore getByteStore()
          Get internal ByteStore object buffering bytes between Megs.
abstract  long getTimeout()
          Access the timeout value for read operations.
abstract  boolean isClosed()
          Determine if the meg output stream is closed.
abstract  void setTimeout(long timeout)
          Set a timeout value for write operations.
abstract  void write(byte[] buf)
          Write a byte array to the stream.
abstract  void write(byte[] buf, int offset, int length)
          Write a portion of the passed byte buffer array.
abstract  void write(ByteStore byteBuf)
          Write the bytes from the ByteStore to the stream.
abstract  void write(java.io.InputStream in)
          Write the data from the input stream.
abstract  void write(int iByte)
          Write a byte to the stream.
abstract  void write(java.lang.String buf)
          Deprecated. Use a MegWriter instead.
abstract  void write(java.lang.String buf, int offset, int length)
          Deprecated. Use a MegWriter instead.
abstract  void write(java.lang.String buf, int offset, int length, java.lang.String enc)
          Deprecated. Use a MegWriter instead.
abstract  void write(java.lang.String buf, java.lang.String enc)
          Deprecated. Use a MegWriter instead.
abstract  void writeLine(byte[] buf)
          Write the byte array to the stream followed by the end of line sequence.
abstract  void writeLine(byte[] buf, int offset, int length)
          Write a portion of the passed byte buffer array followed by the end of line sequence.
abstract  void writeLine(ByteStore buf)
          Deprecated. Use a MegWriter instead.
abstract  void writeLine(java.lang.String buf)
          Deprecated. Use a MegWriter instead.
abstract  void writeLine(java.lang.String buf, int offset, int length)
          Deprecated. Use a MegWriter instead.
abstract  void writeLine(java.lang.String buf, int offset, int length, java.lang.String enc)
          Deprecated. Use a MegWriter instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MegOutputStream

public MegOutputStream()
Constructs a new MegOutputStream.
Method Detail

getByteStore

public abstract ByteStore getByteStore()
Get internal ByteStore object buffering bytes between Megs.
Returns:
The ByteStore class.

write

public abstract void write(byte[] buf,
                           int offset,
                           int length)
                    throws java.io.IOException
Write a portion of the passed byte buffer array.
Overrides:
write in class java.io.OutputStream
Parameters:
buf - The byte buffer array.
offset - Offset in the array to start writing from.
length - The amount from offset to write.
Throws:
java.io.IOException - If unable to write to stream.

write

public abstract void write(int iByte)
                    throws java.io.IOException
Write a byte to the stream.
Overrides:
write in class java.io.OutputStream
Parameters:
iByte - The byte to write.
Throws:
java.io.IOException - If unable to write to stream.

write

public abstract void write(byte[] buf)
                    throws java.io.IOException
Write a byte array to the stream.
Overrides:
write in class java.io.OutputStream
Parameters:
buf - The byte array to write.
Throws:
java.io.IOException - If unable to write to stream.

write

public abstract void write(java.lang.String buf)
                    throws java.io.IOException
Deprecated. Use a MegWriter instead.

Write a string to the stream.
Parameters:
buf - The string to write using (8859_1 encoding).
Throws:
java.io.IOException - If unable to write to stream.

write

public abstract void write(java.lang.String buf,
                           java.lang.String enc)
                    throws java.io.IOException,
                           java.io.UnsupportedEncodingException
Deprecated. Use a MegWriter instead.

Write a string to the stream using the specified encoding.
Parameters:
buf - The string to write.
enc - The encoding to use.
Throws:
java.io.IOException - If unable to write to stream.
java.io.UnsupportedEncodingException - If the encoding is not supported.

write

public abstract void write(ByteStore byteBuf)
                    throws java.io.IOException
Write the bytes from the ByteStore to the stream.
Parameters:
byteBuf - The ByteStore.
Throws:
java.io.IOException - If unable to write to stream.

write

public abstract void write(java.lang.String buf,
                           int offset,
                           int length)
                    throws java.io.IOException
Deprecated. Use a MegWriter instead.

Write the a portion of a string to the stream.
Parameters:
buf - The string.
offset - Offset in the string to start writing.
length - The length from offset to write.
Throws:
java.io.IOException - If unable to write to stream.

write

public abstract void write(java.lang.String buf,
                           int offset,
                           int length,
                           java.lang.String enc)
                    throws java.io.IOException,
                           java.io.UnsupportedEncodingException
Deprecated. Use a MegWriter instead.

Write the a portion of a string to the stream.
Parameters:
buf - The string.
offset - Offset in the string to start writing.
length - The length from offset to write.
enc - The encoding of the string.
Throws:
java.io.IOException - If unable to write to stream.
java.io.UnsupportedEncodingException - If the encoding is not supported.

write

public abstract void write(java.io.InputStream in)
                    throws java.io.IOException
Write the data from the input stream. This effectively skips a data buffer.
Parameters:
in - The input stream.
Throws:
java.io.IOException - An error occurs.

writeLine

public abstract void writeLine(byte[] buf)
                        throws java.io.IOException
Write the byte array to the stream followed by the end of line sequence.
Parameters:
buf - The byte array.
Throws:
java.io.IOException - If unable to write to stream.

writeLine

public abstract void writeLine(byte[] buf,
                               int offset,
                               int length)
                        throws java.io.IOException
Write a portion of the passed byte buffer array followed by the end of line sequence.
Parameters:
buf - The byte buffer array.
offset - Offset in the array to start writing from.
length - The amount from offset to write.
Throws:
java.io.IOException - If unable to write to stream.

writeLine

public abstract void writeLine(java.lang.String buf)
                        throws java.io.IOException
Deprecated. Use a MegWriter instead.

Write a string to the stream followed by the end of line sequence.
Parameters:
buf - The string to write using (8859_1 encoding).
Throws:
java.io.IOException - If unable to write to stream.

writeLine

public abstract void writeLine(ByteStore buf)
                        throws java.io.IOException
Deprecated. Use a MegWriter instead.

Write the bytes from the bytebuffer to the stream followed by the end of line sequence.
Parameters:
buf - The ByteStore.
Throws:
java.io.IOException - If unable to write to stream.

writeLine

public abstract void writeLine(java.lang.String buf,
                               int offset,
                               int length)
                        throws java.io.IOException
Deprecated. Use a MegWriter instead.

Write the a portion of a string to the stream followed by the end of line sequence.
Parameters:
buf - The string.
offset - Offset in the string to start writing.
length - The length from offset to write.
Throws:
java.io.IOException - If unable to write to stream.

writeLine

public abstract void writeLine(java.lang.String buf,
                               int offset,
                               int length,
                               java.lang.String enc)
                        throws java.io.IOException,
                               java.io.UnsupportedEncodingException
Deprecated. Use a MegWriter instead.

Write the a portion of a string to the stream followed by the end of line sequence.
Parameters:
buf - The string.
offset - Offset in the string to start writing.
length - The length from offset to write.
enc - The encoding of the string.
Throws:
java.io.IOException - If unable to write to stream.
java.io.UnsupportedEncodingException - If the encoding is not supported.

setTimeout

public abstract void setTimeout(long timeout)
Set a timeout value for write operations. Writes will not block longer than the timeout time. If a timeout occurs, then an InterruptedIOException will be thrown.
Parameters:
timeout - The maximum time to block for write operations, in milliseconds. A value of zero (the default) means to never timeout.

getTimeout

public abstract long getTimeout()
Access the timeout value for read operations.
Returns:
The maximum time to block for read operations, in milliseconds. A value of zero means to never timeout.

close

public abstract void close()
                    throws java.io.IOException
Close the meg output stream.
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - If error occurred closing stream.

isClosed

public abstract boolean isClosed()
Determine if the meg output stream is closed.
Returns:
true if closed.

flush

public abstract void flush()
                    throws java.io.IOException
Flush the output stream. Will also clone the RequestInfo if not already done so.
Overrides:
flush in class java.io.OutputStream