Top Description Fields Constructors Methods
org.osgi.service.url

public abstract Class AbstractURLStreamHandlerService

extends URLStreamHandler
implements URLStreamHandlerService
Class Inheritance
All Implemented Interfaces
org.osgi.service.url.URLStreamHandlerService
Annotations
@ConsumerType
Imports
java.net.InetAddress, .URL, .URLConnection, .URLStreamHandler, org.osgi.annotation.versioning.ConsumerType

Abstract implementation of the URLStreamHandlerService interface. All the methods simply invoke the corresponding methods on java.net.URLStreamHandler except for parseURL and setURL, which use the URLStreamHandlerSetter parameter. Subclasses of this abstract class should not need to override the setURL and parseURL(URLStreamHandlerSetter,...) methods.
Author
$Id: 79cfc45d97b037436d50bda26111109bd5d42a37 $

Field Summary

Modifier and TypeField and Description
protected volatile URLStreamHandlerSetter
realHandler

The URLStreamHandlerSetter object passed to the parseURL method.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(URL
a URL object
u1
,
URL
a URL object
u2
)

Overrides java.net.URLStreamHandler.equals.

Implements org.osgi.service.url.URLStreamHandlerService.equals.

This method calls super.equals(URL,URL).

public int
public InetAddress
getHostAddress(URL
a URL object
u
)

Overrides java.net.URLStreamHandler.getHostAddress.

Implements org.osgi.service.url.URLStreamHandlerService.getHostAddress.

This method calls super.getHostAddress.

public int
hashCode(URL
a URL object
u
)

Overrides java.net.URLStreamHandler.hashCode.

Implements org.osgi.service.url.URLStreamHandlerService.hashCode.

This method calls super.hashCode(URL).

public boolean
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.

Implements org.osgi.service.url.URLStreamHandlerService.hostsEqual.

This method calls super.hostsEqual.

public abstract URLConnection
openConnection(URL
the URL that this connects to.
u
)

Redeclares org.osgi.service.url.URLStreamHandlerService.openConnection.

Implements abstract java.net.URLStreamHandler.openConnection.

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

public void
parseURL(URLStreamHandlerSetter
The object on which the setURL method must be invoked for the specified URL.
realHandler
,
URL u, String spec, int start, int limit)

Implements org.osgi.service.url.URLStreamHandlerService.parseURL.

Parse a URL using the URLStreamHandlerSetter object.

public boolean
sameFile(URL
a URL object
u1
,
URL
a URL object
u2
)

Overrides java.net.URLStreamHandler.sameFile.

Implements org.osgi.service.url.URLStreamHandlerService.sameFile.

This method calls super.sameFile.

protected void
setURL(URL
the URL to modify.
u
,
String
the protocol name. This value is ignored since 1.2.
proto
,
String
the remote host value for the URL.
host
,
int
the port on the remote machine.
port
,
String
the file.
file
,
String
the reference.
ref
)

Overrides java.net.URLStreamHandler.setURL.

Deprecated This method is only for compatibility with handlers written for JDK 1.1.

This method calls realHandler.setURL(URL,String,String,int,String,String).

protected void
setURL(URL
the URL to modify.
u
,
String
the protocol name.
proto
,
String
the remote host value for the URL.
host
,
int
the port on the remote machine.
port
,
String
the authority part for the URL.
auth
,
String
the userInfo part of the URL.
user
,
String
the path component of the URL.
path
,
String
the query part for the URL.
query
,
String
the reference.
ref
)

Overrides java.net.URLStreamHandler.setURL.

This method calls realHandler.setURL(URL,String,String,int,String,String,String,String) .

public String
Inherited from java.net.URLStreamHandler:
openConnectionparseURL

Field Detail

realHandlerback to summary
protected volatile URLStreamHandlerSetter realHandler

The URLStreamHandlerSetter object passed to the parseURL method.

Constructor Detail

AbstractURLStreamHandlerServiceback to summary
public AbstractURLStreamHandlerService()

Method Detail

equalsback to summary
public boolean equals(URL u1, URL u2)

Overrides java.net.URLStreamHandler.equals.

Implements org.osgi.service.url.URLStreamHandlerService.equals.

This method calls super.equals(URL,URL).

Parameters
u1:URL

Doc from java.net.URLStreamHandler.equals.

a URL object

u2:URL

Doc from java.net.URLStreamHandler.equals.

a URL object

Returns:boolean

Doc from java.net.URLStreamHandler.equals.

true if the two urls are considered equal, i.e. they refer to the same fragment in the same file.

Annotations
@Override
See Also
java.net.URLStreamHandler.equals(URL,URL)
getDefaultPortback to summary
public int getDefaultPort()

Overrides java.net.URLStreamHandler.getDefaultPort.

Implements org.osgi.service.url.URLStreamHandlerService.getDefaultPort.

This method calls super.getDefaultPort.

Returns:int

Doc from java.net.URLStreamHandler.getDefaultPort.

the default port for a URL parsed by this handler.

Annotations
@Override
See Also
java.net.URLStreamHandler.getDefaultPort
getHostAddressback to summary
public InetAddress getHostAddress(URL u)

Overrides java.net.URLStreamHandler.getHostAddress.

Implements org.osgi.service.url.URLStreamHandlerService.getHostAddress.

This method calls super.getHostAddress.

Parameters
u:URL

Doc from java.net.URLStreamHandler.getHostAddress.

a URL object

Returns:InetAddress

Doc from java.net.URLStreamHandler.getHostAddress.

an InetAddress representing the host IP address.

Annotations
@Override
See Also
java.net.URLStreamHandler.getHostAddress
hashCodeback to summary
public int hashCode(URL u)

Overrides java.net.URLStreamHandler.hashCode.

Implements org.osgi.service.url.URLStreamHandlerService.hashCode.

This method calls super.hashCode(URL).

Parameters
u:URL

Doc from java.net.URLStreamHandler.hashCode.

a URL object

Returns:int

Doc from java.net.URLStreamHandler.hashCode.

an int suitable for hash table indexing

Annotations
@Override
See Also
java.net.URLStreamHandler.hashCode(URL)
hostsEqualback to summary
public boolean hostsEqual(URL u1, URL u2)

Overrides java.net.URLStreamHandler.hostsEqual.

Implements org.osgi.service.url.URLStreamHandlerService.hostsEqual.

This method calls super.hostsEqual.

Parameters
u1:URL

Doc from java.net.URLStreamHandler.hostsEqual.

the URL of the first host to compare

u2:URL

Doc from java.net.URLStreamHandler.hostsEqual.

the URL of the second host to compare

Returns:boolean

Doc from java.net.URLStreamHandler.hostsEqual.

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

Annotations
@Override
See Also
java.net.URLStreamHandler.hostsEqual
openConnectionback to summary
public abstract URLConnection openConnection(URL u) throws IOException

Redeclares org.osgi.service.url.URLStreamHandlerService.openConnection.

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.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while opening the connection.
See Also
java.net.URLStreamHandler.openConnection
parseURLback to summary
public void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit)

Implements org.osgi.service.url.URLStreamHandlerService.parseURL.

Parse a URL using the URLStreamHandlerSetter object. This method sets the realHandler field with the specified URLStreamHandlerSetter object and then calls parseURL(URL,String,int,int).

Parameters
realHandler:URLStreamHandlerSetter

The object on which the setURL method must be invoked for the specified URL.

See Also
java.net.URLStreamHandler.parseURL
sameFileback to summary
public boolean sameFile(URL u1, URL u2)

Overrides java.net.URLStreamHandler.sameFile.

Implements org.osgi.service.url.URLStreamHandlerService.sameFile.

This method calls super.sameFile.

Parameters
u1:URL

Doc from java.net.URLStreamHandler.sameFile.

a URL object

u2:URL

Doc from java.net.URLStreamHandler.sameFile.

a URL object

Returns:boolean

Doc from java.net.URLStreamHandler.sameFile.

true if u1 and u2 refer to the same file

Annotations
@Override
See Also
java.net.URLStreamHandler.sameFile
setURLback to summary
protected void setURL(URL u, String proto, String host, int port, String file, String ref)

Overrides java.net.URLStreamHandler.setURL.

Deprecated

This method is only for compatibility with handlers written for JDK 1.1.

This method calls realHandler.setURL(URL,String,String,int,String,String).

Parameters
u:URL

Doc from java.net.URLStreamHandler.setURL.

the URL to modify.

proto:String

Doc from java.net.URLStreamHandler.setURL.

the protocol name. This value is ignored since 1.2.

host:String

Doc from java.net.URLStreamHandler.setURL.

the remote host value for the URL.

port:int

Doc from java.net.URLStreamHandler.setURL.

the port on the remote machine.

file:String

Doc from java.net.URLStreamHandler.setURL.

the file.

ref:String

Doc from java.net.URLStreamHandler.setURL.

the reference.

Annotations
@SuppressWarnings:javadoc
See Also
java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)
setURLback to summary
protected void setURL(URL u, String proto, String host, int port, String auth, String user, String path, String query, String ref)

Overrides java.net.URLStreamHandler.setURL.

This method calls realHandler.setURL(URL,String,String,int,String,String,String,String) .

Parameters
u:URL

Doc from java.net.URLStreamHandler.setURL.

the URL to modify.

proto:String

Doc from java.net.URLStreamHandler.setURL.

the protocol name.

host:String

Doc from java.net.URLStreamHandler.setURL.

the remote host value for the URL.

port:int

Doc from java.net.URLStreamHandler.setURL.

the port on the remote machine.

auth:String

Doc from java.net.URLStreamHandler.setURL.

the authority part for the URL.

user:String

Doc from java.net.URLStreamHandler.setURL.

the userInfo part of the URL.

path:String

Doc from java.net.URLStreamHandler.setURL.

the path component of the URL.

query:String

Doc from java.net.URLStreamHandler.setURL.

the query part for the URL.

ref:String

Doc from java.net.URLStreamHandler.setURL.

the reference.

Annotations
@Override
See Also
java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)
toExternalFormback to summary
public String toExternalForm(URL u)

Overrides java.net.URLStreamHandler.toExternalForm.

Implements org.osgi.service.url.URLStreamHandlerService.toExternalForm.

This method calls super.toExternalForm.

Parameters
u:URL

Doc from java.net.URLStreamHandler.toExternalForm.

the URL.

Returns:String

Doc from java.net.URLStreamHandler.toExternalForm.

a string representation of the URL argument.

Annotations
@Override
See Also
java.net.URLStreamHandler.toExternalForm