org.apache.geronimo.javamail.util
Class MIMEOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.geronimo.javamail.util.MIMEOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class MIMEOutputStream
extends OutputStream

An implementation of an OutputStream that performs MIME linebreak canonicalization and "byte-stuff" so that data content does not get mistaken for a message data-end marker (CRLF.CRLF)l

Version:
$Rev: 670717 $ $Date: 2008-06-23 15:41:19 -0400 (Mon, 23 Jun 2008) $

Field Summary
protected  boolean atLineBreak
           
protected  int lastWrite
           
protected  OutputStream out
           
 
Constructor Summary
MIMEOutputStream(OutputStream out)
          Create an output stream that writes to the target output stream.
 
Method Summary
 void forceTerminatingLineBreak()
          Force the stream to be terminated at a line break.
 void write(int ch)
           
 void writeSMTPTerminator()
          Write out the SMTP terminator to the output stream.
 
Methods inherited from class java.io.OutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected OutputStream out

lastWrite

protected int lastWrite

atLineBreak

protected boolean atLineBreak
Constructor Detail

MIMEOutputStream

public MIMEOutputStream(OutputStream out)
Create an output stream that writes to the target output stream.

Parameters:
out - The wrapped output stream.
Method Detail

write

public void write(int ch)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

forceTerminatingLineBreak

public void forceTerminatingLineBreak()
                               throws IOException
Force the stream to be terminated at a line break. This is generally in preparation for the transport to write out an end-of-data marker, which generally needs to be preceded by a CRLF sequence.

Throws:
IOException

writeSMTPTerminator

public void writeSMTPTerminator()
                         throws IOException
Write out the SMTP terminator to the output stream. This ensures that we don't write out an extra CRLF if the data terminates with that value.

Throws:
IOException


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.