Top Description Fields Constructors Methods
com.sun.mail.smtp

public Class SMTPOutputStream

extends CRLFOutputStream
Class Inheritance
Known Direct Subclasses
com.sun.mail.smtp.SMTPTransport.BDATOutputStream
Imports
java.io.*, com.sun.mail.util.CRLFOutputStream

In addition to converting lines into the canonical format, i.e., terminating lines with the CRLF sequence, escapes the "." by adding another "." to any "." that appears in the beginning of a line. See RFC821 section 4.5.2.
Author
Max Spivak
See Also
CRLFOutputStream

Field Summary

Inherited from com.sun.mail.util.CRLFOutputStream:
atBOLlastb

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
ensureAtBOL()

Ensure we're at the beginning of a line.

public void
flush()

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

Override flush method in FilterOutputStream.
public void
write(int
the byte.
b
)

Overrides com.sun.mail.util.CRLFOutputStream.write.

Writes the specified byte to this output stream.
public void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides com.sun.mail.util.CRLFOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
Inherited from com.sun.mail.util.CRLFOutputStream:
writewriteln

Constructor Detail

SMTPOutputStreamback to summary
public SMTPOutputStream(OutputStream os)

Method Detail

ensureAtBOLback to summary
public void ensureAtBOL() throws IOException

Ensure we're at the beginning of a line. Write CRLF if not.

Exceptions
IOException:
if the write fails
flushback to summary
public void flush()

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

Override flush method in FilterOutputStream. The MimeMessage writeTo method flushes its buffer at the end, but we don't want to flush data out to the socket until we've also written the terminating "\r\n.\r\n". We buffer nothing so there's nothing to flush. We depend on the fact that CRLFOutputStream also buffers nothing. SMTPTransport will manually flush the socket before reading the response.

Annotations
@Override
writeback to summary
public void write(int b) throws IOException

Overrides com.sun.mail.util.CRLFOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes the specified byte to this output stream.

The write method of FilterOutputStream calls the write method of its underlying output stream, that is, it performs out.write(b).

Implements the abstract write method of OutputStream.

Parameters
b:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides com.sun.mail.util.CRLFOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.