com.ibm.atp
Class ContentOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ByteArrayOutputStream
          extended bycom.ibm.atp.ContentOutputStream
All Implemented Interfaces:
ContentBuffer

public final class ContentOutputStream
extends java.io.ByteArrayOutputStream
implements ContentBuffer

The content output stream writes a message content to the given output stream. The content output stream creats MIME header fields, combines it with a message body, and writes it into the specifid output stream.

Version:
1.20 3 Mar 1997
Author:
Danny B. Lange, Gaku Yamamoto, Mitsuru Oshima

Field Summary
protected  java.io.OutputStream _out
          An output stream into which ATP messages is written.
(package private)  byte[] buffer
           
private static int BUFFSIZE
           
private  boolean content_sent
           
private  boolean content_started
           
static java.lang.String CRLF
          A separator in the message's header.
(package private)  int wrote
           
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
ContentOutputStream(java.io.OutputStream os)
          Create a new instance of ContentOutputStream.
ContentOutputStream(java.io.OutputStream os, boolean started)
           
 
Method Summary
 void close()
          Close the stream.
 void flush()
           
 void sendContent()
           
 void startContent()
           
 
Methods inherited from class java.io.ByteArrayOutputStream
reset, size, toByteArray, toString, toString, toString, write, write, writeTo
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CRLF

public static final java.lang.String CRLF
A separator in the message's header.

See Also:
Constant Field Values

_out

protected java.io.OutputStream _out
An output stream into which ATP messages is written. An atp output stream writes ATP messages into it.


content_started

private boolean content_started

content_sent

private boolean content_sent

BUFFSIZE

private static int BUFFSIZE

wrote

int wrote

buffer

byte[] buffer
Constructor Detail

ContentOutputStream

public ContentOutputStream(java.io.OutputStream os)
Create a new instance of ContentOutputStream.

Parameters:
os - an instance of OutputStream into which the instantiated atp output stream writes.

ContentOutputStream

public ContentOutputStream(java.io.OutputStream os,
                           boolean started)
Method Detail

close

public void close()
           throws java.io.IOException
Close the stream. This automatically flushe if the request has not been sent.

Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

sendContent

public void sendContent()
                 throws java.io.IOException
Specified by:
sendContent in interface ContentBuffer
Throws:
java.io.IOException

startContent

public void startContent()
                  throws java.io.IOException
Throws:
java.io.IOException