FileDocCategorySizeDatePackage
Transport.javaAPI DocAndroid 1.5 API5415Wed May 06 22:42:46 BST 2009com.android.email.mail

Transport

public interface Transport
This interface defines a "transport", which is defined here as being one layer below the specific wire protocols such as POP3, IMAP, or SMTP. Practically speaking, it provides a definition of the common functionality between them (dealing with sockets & streams, SSL, logging, and so forth), and provides a seam just below the individual protocols to enable better testing. The following features are supported and presumed to be common: Interpretation of URI Support for SSL and TLS wireline security

Fields Summary
public static final int
CONNECTION_SECURITY_NONE
Connection security options for transport that supports SSL and/or TLS
public static final int
CONNECTION_SECURITY_TLS_OPTIONAL
public static final int
CONNECTION_SECURITY_TLS_REQUIRED
public static final int
CONNECTION_SECURITY_SSL_REQUIRED
public static final int
CONNECTION_SECURITY_SSL_OPTIONAL
Constructors Summary
Methods Summary
public booleancanTrySslSecurity()

return
true if the security mode indicates that SSL is possible (optional or required)

public booleancanTryTlsSecurity()

return
true if the security mode indicates that TLS is possible (optional or required)

public voidclose()
Closes the connection. Does not send any closure messages, simply closes the socket and the associated streams. Best effort only. Catches all exceptions and always returns. MUST NOT throw any exceptions.

public java.lang.StringgetHost()

return
Returns the host part of the Uri

public java.io.InputStreamgetInputStream()

return
returns the active input stream

public java.io.OutputStreamgetOutputStream()

return
returns the active output stream

public intgetPort()

return
Returns the port (either from the Uri or from the default)

public intgetSecurity()

return
Returns the desired security mode for this connection.

public java.lang.String[]getUserInfoParts()
Returns the user info parts of the Uri, if any were supplied. Typically, [0] is the user and [1] is the password.

return
Returns the user info parts of the Uri. Null if none were supplied.

public booleanisOpen()

return
true if the connection is open

public com.android.email.mail.TransportnewInstanceWithConfiguration()
Get a new transport, using an existing one as a model. The new transport is configured as if setUri() and setSecurity() have been called, but not opened or connected in any way.

return
a new Transport ready to open()

public voidopen()
Attempts to open the connection using the supplied parameters, and using SSL if indicated.

public java.lang.StringreadLine()
Reads a single line from the server. Any delimiter characters will not be included in the result. May generate a log entry, if enabled.

return
Returns the string from the server.
throws
IOException

public voidreopenTls()
Attempts to reopen the connection using TLS.

public voidsetSecurity(int connectionSecurity)
Set the desired security mode for this connection.

param
connectionSecurity A value indicating the desired security mode.

public voidsetSoTimeout(int timeoutMilliseconds)
Set the socket timeout.

param
timeoutMilliseconds the read timeout value if greater than {@code 0}, or {@code 0} for an infinite timeout.

public voidsetUri(java.net.URI uri, int defaultPort)
Set the Uri for the connection.

param
uri The Uri for the connection
param
defaultPort If the Uri does not include an explicit port, this value will be used.

public voidwriteLine(java.lang.String s, java.lang.String sensitiveReplacement)
Write a single line to the server, and may generate a log entry (if enabled).

param
s The text to send to the server.
param
sensitiveReplacement If the command includes sensitive data (e.g. authentication) please pass a replacement string here (for logging). Most callers simply pass null,