Top Description Fields Constructors Methods
org.apache.tools.mail

public Class SmtpResponseReader

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader

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

Modifier and TypeField and Description
protected BufferedReader

Constructor Summary

AccessConstructor and Description
public
SmtpResponseReader(InputStream
the stream to wrap.
in
)

Wrap this input stream.

Method Summary

Modifier and TypeMethod and Description
private static void
appendTo(StringBuilder target, String line)

Append the text from this line of the response.

public void
close()

Closes the underlying stream.

public String

Returns:

Response code (3 digits) + Blank + Text from all response line concatenated (with blanks replacing the \r\n sequences).
getResponse
()

Read until the server indicates that the response is complete.

protected boolean

Returns:

true if there are more lines to check.
hasMoreLines
(String
the line to check.
line
)

Should we expect more input?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

readerback to summary
protected BufferedReader reader

Constructor Detail

SmtpResponseReaderback to summary
public SmtpResponseReader(InputStream in)

Wrap this input stream.

Parameters
in:InputStream

the stream to wrap.

Method Detail

appendToback to summary
private static void appendTo(StringBuilder target, String line)

Append the text from this line of the response.

closeback to summary
public void close() throws IOException

Closes the underlying stream.

Exceptions
IOException:
on error.
getResponseback to summary
public String getResponse() throws IOException

Read until the server indicates that the response is complete.

Returns:String

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

Exceptions
IOException:
on error.
hasMoreLinesback to summary
protected boolean hasMoreLines(String line)

Should we expect more input?

Parameters
line:String

the line to check.

Returns:boolean

true if there are more lines to check.