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

public Class Handler

extends URLStreamHandler
Class Inheritance
Imports
java.net.URLConnection, .URL, .Proxy, .URLStreamHandler, java.io.IOException, .File, sun.net.www.ParseUtil

Open an file input stream given a URL.
Author
James Gosling

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected URLConnection
protected boolean

Returns:

true if and only if they are equal, false otherwise.
hostsEqual
(URL
the URL of the first host to compare
u1
,
URL
the URL of the second host to compare
u2
)

Overrides java.net.URLStreamHandler.hostsEqual.

Compares the host components of two URLs.

public URLConnection
openConnection(URL u)

Implements abstract java.net.URLStreamHandler.openConnection.

Opens a connection to the object referenced by the URL argument.

public URLConnection
openConnection(URL u, Proxy p)

Overrides java.net.URLStreamHandler.openConnection.

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.

protected void
parseURL(URL u, String spec, int start, int limit)

Overrides java.net.URLStreamHandler.parseURL.

Parses the string representation of a URL into a URL object.

Inherited from java.net.URLStreamHandler:
equalsgetDefaultPortgetHostAddresshashCodesameFilesetURLsetURLtoExternalForm

Constructor Detail

Handlerback to summary
public Handler()

Method Detail

createFileURLConnectionback to summary
protected URLConnection createFileURLConnection(URL u, File file)
hostsEqualback to summary
protected boolean hostsEqual(URL u1, URL u2)

Overrides java.net.URLStreamHandler.hostsEqual.

Compares the host components of two URLs.

Parameters
u1:URL

the URL of the first host to compare

u2:URL

the URL of the second host to compare

Returns:boolean

true if and only if they are equal, false otherwise.

openConnectionback to summary
public URLConnection openConnection(URL u) throws IOException

Implements abstract java.net.URLStreamHandler.openConnection.

Doc from java.net.URLStreamHandler.openConnection.

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.

Exceptions
IOException:
if an I/O error occurs while opening the connection.
openConnectionback to summary
public URLConnection openConnection(URL u, Proxy p) throws IOException

Overrides java.net.URLStreamHandler.openConnection.

Doc from java.net.URLStreamHandler.openConnection.

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.

Exceptions
IOException:
if an I/O error occurs while opening the connection.
parseURLback to summary
protected void parseURL(URL u, String spec, int start, int limit)

Overrides java.net.URLStreamHandler.parseURL.

Doc from java.net.URLStreamHandler.parseURL.

Parses the string representation of a URL into a URL object.

If there is any inherited context, then it has already been copied into the URL argument.

The parseURL method of URLStreamHandler parses the string representation as if it were an http specification. Most URL protocol families have a similar parsing. A stream protocol handler for a protocol that has a different syntax must override this routine.