APIdia Launch Partner
Top Description Fields Constructors Methods
sun.net.www.protocol.mailto

public Class MailToURLConnection

extends URLConnection
Class Inheritance
Imports
java.net.URL, .InetAddress, java.io.*, jdk.internal.util.StaticProperty, sun.net.www.*, .ParseUtil, sun.net.smtp.SmtpClient

Handle mailto URLs. To send mail using a mailto URLConnection, call getOutputStream, write the message to the output stream, and close it.

Field Summary

Modifier and TypeField and Description
pack-priv SmtpClient
private int
pack-priv InputStream
pack-priv OutputStream
private int
Inherited from sun.net.www.URLConnection:
properties

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
connect()

Implements abstract java.net.URLConnection.connect.

Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

public int
getConnectTimeout()

Overrides java.net.URLConnection.getConnectTimeout.

Returns setting for connect timeout.

pack-priv String
getFromAddress()

Get the user's full email address - stolen from HotJavaApplet.getMailAddress().

public synchronized OutputStream
getOutputStream()

Overrides java.net.URLConnection.getOutputStream.

Returns an output stream that writes to this connection.

public int
getReadTimeout()

Overrides java.net.URLConnection.getReadTimeout.

Returns setting for read timeout.

public void
setConnectTimeout(int timeout)

Overrides java.net.URLConnection.setConnectTimeout.

Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection.

public void
setReadTimeout(int timeout)

Overrides java.net.URLConnection.setReadTimeout.

Sets the read timeout to a specified timeout, in milliseconds.

Inherited from sun.net.www.URLConnection:
addRequestPropertycanCachecloseensureCanServeHeadersgetContentLengthgetContentTypegetHeaderFieldgetHeaderFieldgetHeaderFieldKeygetHeaderFieldsgetPropertiesgetRequestPropertiesgetRequestPropertyisProxiedHostsetContentLengthsetContentTypesetPropertiessetProxiedHostsetRequestProperty

Field Detail

clientback to summary
pack-priv SmtpClient client
connectTimeoutback to summary
private int connectTimeout

Hides java.net.URLConnection.connectTimeout.

isback to summary
pack-priv InputStream is
osback to summary
pack-priv OutputStream os
readTimeoutback to summary
private int readTimeout

Hides java.net.URLConnection.readTimeout.

Constructor Detail

MailToURLConnectionback to summary
pack-priv MailToURLConnection(URL u)

Method Detail

connectback to summary
public void connect() throws IOException

Implements abstract java.net.URLConnection.connect.

Doc from java.net.URLConnection.connect.

Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

If the connect method is called when the connection has already been opened (indicated by the connected field having the value true), the call is ignored.

URLConnection objects go through two phases: first they are created, then they are connected. After being created, and before being connected, various options can be specified (e.g., doInput and UseCaches). After connecting, it is an error to try to set them. Operations that depend on being connected, like getContentLength, will implicitly perform the connection, if necessary.

Exceptions
IOException:
if an I/O error occurs while opening the connection.
getConnectTimeoutback to summary
public int getConnectTimeout()

Overrides java.net.URLConnection.getConnectTimeout.

Doc from java.net.URLConnection.getConnectTimeout.

Returns setting for connect timeout.

0 return implies that the option is disabled (i.e., timeout of infinity).

Annotations
@Override
getFromAddressback to summary
pack-priv String getFromAddress()

Get the user's full email address - stolen from HotJavaApplet.getMailAddress().

getOutputStreamback to summary
public synchronized OutputStream getOutputStream() throws IOException

Overrides java.net.URLConnection.getOutputStream.

Doc from java.net.URLConnection.getOutputStream.

Returns an output stream that writes to this connection.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while creating the output stream.
getReadTimeoutback to summary
public int getReadTimeout()

Overrides java.net.URLConnection.getReadTimeout.

Doc from java.net.URLConnection.getReadTimeout.

Returns setting for read timeout. 0 return implies that the option is disabled (i.e., timeout of infinity).

Annotations
@Override
setConnectTimeoutback to summary
public void setConnectTimeout(int timeout)

Overrides java.net.URLConnection.setConnectTimeout.

Doc from java.net.URLConnection.setConnectTimeout.

Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection. If the timeout expires before the connection can be established, a java.net.SocketTimeoutException is raised. A timeout of zero is interpreted as an infinite timeout.

Some non-standard implementation of this method may ignore the specified timeout. To see the connect timeout set, please call getConnectTimeout().

Annotations
@Override
setReadTimeoutback to summary
public void setReadTimeout(int timeout)

Overrides java.net.URLConnection.setReadTimeout.

Doc from java.net.URLConnection.setReadTimeout.

Sets the read timeout to a specified timeout, in milliseconds. A non-zero value specifies the timeout when reading from Input stream when a connection is established to a resource. If the timeout expires before there is data available for read, a java.net.SocketTimeoutException is raised. A timeout of zero is interpreted as an infinite timeout.

Some non-standard implementation of this method ignores the specified timeout. To see the read timeout set, please call getReadTimeout().

Annotations
@Override