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
the URL that this connects to.
u
)

Implements abstract java.net.URLStreamHandler.openConnection.

Opens a connection to the object referenced by the URL argument.
public URLConnection
openConnection(URL
the URL that this connects to.
u
,
Proxy
the proxy through which the connection will be made. If direct connection is desired, Proxy.NO_PROXY should be specified.
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
the URL to receive the result of parsing the spec.
u
,
String
the String representing the URL that must be parsed.
spec
,
int
the character index at which to begin parsing. This is just past the ':' (if there is one) that specifies the determination of the protocol name.
start
,
int
the character position to stop parsing at. This is the end of the string or the position of the "#" character, if present. All information after the sharp sign indicates an anchor.
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.

Parameters
u:URL

the URL that this connects to.

Returns:URLConnection

a URLConnection object for the URL.

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.

Parameters
u:URL

the URL that this connects to.

p:Proxy

the proxy through which the connection will be made. If direct connection is desired, Proxy.NO_PROXY should be specified.

Returns:URLConnection

a URLConnection object for the URL.

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.

Parameters
u:URL

the URL to receive the result of parsing the spec.

spec:String

the String representing the URL that must be parsed.

start:int

the character index at which to begin parsing. This is just past the ':' (if there is one) that specifies the determination of the protocol name.

limit:int

the character position to stop parsing at. This is the end of the string or the position of the "#" character, if present. All information after the sharp sign indicates an anchor.