org.apache.tools.mailClass SmtpResponseReader
- java.lang.Object
- org.apache.tools.mail.SmtpResponseReader
public class SmtpResponseReader extends java.lang.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
Fields Modifier and Type Field and Description protected java.io.BufferedReader
reader
Constructor Summary
Constructors Constructor and Description SmtpResponseReader(java.io.InputStream in)
Wrap this input stream.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
close()
Closes the underlying stream.java.lang.String
getResponse()
Read until the server indicates that the response is complete.protected boolean
hasMoreLines(java.lang.String line)
Should we expect more input?
Constructor Detail
SmtpResponseReader
public SmtpResponseReader(java.io.InputStream in)Wrap this input stream.
- Parameters:
in
- the stream to wrap.
Method Detail
getResponse
public java.lang.String getResponse() throws java.io.IOExceptionRead until the server indicates that the response is complete.
- Returns:
- Response code (3 digits) + Blank + Text from all response line concatenated (with blanks replacing the \r\n sequences).
- Throws:
java.io.IOException
- on error.
close
public void close() throws java.io.IOExceptionCloses the underlying stream.
- Throws:
java.io.IOException
- on error.
hasMoreLines
protected boolean hasMoreLines(java.lang.String line)Should we expect more input?
- Parameters:
line
- the line to check.- Returns:
- true if there are more lines to check.