org.apache.tools.mail

Class SmtpResponseReader

public class SmtpResponseReader extends Object

A wrapper around the raw input from the SMTP server that assembles multi line responses into a single String.

The same rules used here would apply to FTP and other Telnet based protocols as well.

Field Summary
protected BufferedReaderreader
Constructor Summary
SmtpResponseReader(InputStream in)
Wrap this input stream.
Method Summary
voidclose()
Closes the underlying stream.
StringgetResponse()
Read until the server indicates that the response is complete.
protected booleanhasMoreLines(String line)
Should we expect more input?

Field Detail

reader

protected BufferedReader reader

Constructor Detail

SmtpResponseReader

public SmtpResponseReader(InputStream in)
Wrap this input stream.

Parameters: in the stream to wrap.

Method Detail

close

public void close()
Closes the underlying stream.

Throws: IOException on error.

getResponse

public String getResponse()
Read until the server indicates that the response is complete.

Returns: Responsecode (3 digits) + Blank + Text from all response line concatenated (with blanks replacing the \r\n sequences).

Throws: IOException on error.

hasMoreLines

protected boolean hasMoreLines(String line)
Should we expect more input?

Parameters: line the line to check.

Returns: true if there are more lines to check.