public class

Handler

extends URLStreamHandler
java.lang.Object
   ↳ java.net.URLStreamHandler
     ↳ sun.net.www.protocol.ftp.Handler

Class Overview

open an ftp connection given a URL

Summary

Public Constructors
Handler()
Protected Methods
boolean equals(URL u1, URL u2)
Provides the default equals calculation.
int getDefaultPort()
Returns the default port for a URL parsed by this handler.
URLConnection openConnection(URL u, Proxy p)
Same as openConnection(URL), except that the connection will be made through the specified proxy; Protocol handlers that do not support proxying will ignore the proxy parameter and make a normal connection.
URLConnection openConnection(URL u)
Opens a connection to the object referenced by the URL argument.
[Expand]
Inherited Methods
From class java.net.URLStreamHandler
From class java.lang.Object

Public Constructors

public Handler ()

Protected Methods

protected boolean equals (URL u1, URL u2)

Provides the default equals calculation. May be overidden by handlers for other protocols that have different requirements for equals(). This method requires that none of its arguments is null. This is guaranteed by the fact that it is only called by java.net.URL class.

Parameters
u1 a URL object
u2 a URL object
Returns
  • true if the two urls are considered equal, ie. they refer to the same fragment in the same file.

protected int getDefaultPort ()

Returns the default port for a URL parsed by this handler. This method is meant to be overidden by handlers with default port numbers.

Returns
  • the default port for a URL parsed by this handler.

protected URLConnection openConnection (URL u, Proxy p)

Same as openConnection(URL), except that the connection will be made through the specified proxy; Protocol handlers that do not support proxying will ignore the proxy parameter and make a normal connection. Calling this method preempts the system's default ProxySelector settings.

Parameters
u the URL that this connects to.
p the proxy through which the connection will be made. If direct connection is desired, Proxy.NO_PROXY should be specified.
Returns
  • a URLConnection object for the URL.
Throws
IOException

protected URLConnection openConnection (URL u)

Opens a connection to the object referenced by the URL argument. This method should be overridden by a subclass.

If for the handler's protocol (such as HTTP or JAR), there exists a public, specialized URLConnection subclass belonging to one of the following packages or one of their subpackages: java.lang, java.io, java.util, java.net, the connection returned will be of that subclass. For example, for HTTP an HttpURLConnection will be returned, and for JAR a JarURLConnection will be returned.

Parameters
u the URL that this connects to.
Returns
  • a URLConnection object for the URL.
Throws
IOException