| java.lang.Object | |
| ↳ | java.net.URL |
An instance of class URL specifies the location of a resource on the world wide web as specified by RFC 1738.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new URL instance by parsing the specification.
| |||||||||||
Constructs a new URL by parsing the specification given by
spec and using the context provided by
context. | |||||||||||
Constructs a new URL by parsing the specification given by
spec and using the context provided by
context. | |||||||||||
Constructs a new URL instance using the arguments provided.
| |||||||||||
Constructs a new URL instance using the arguments provided.
| |||||||||||
Constructs a new URL instance using the arguments provided.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Compares the argument to the receiver, and returns true if they represent
the same URL.
| |||||||||||
Returns the authority component of this URL.
| |||||||||||
Returns an Object representing the resource referenced by this URL.
| |||||||||||
Returns an Object representing the resource referenced by this URL.
| |||||||||||
Returns the default port for this URL as defined by the URLStreamHandler.
| |||||||||||
Returns the file component of this URL.
| |||||||||||
Returns the host component of this URL.
| |||||||||||
Returns the path component of this URL.
| |||||||||||
Returns the port component of this URL.
| |||||||||||
Returns the protocol component of this URL.
| |||||||||||
Returns the query component of this URL.
| |||||||||||
Returns the reference component of this URL.
| |||||||||||
Returns the user info component of this URL.
| |||||||||||
Returns a hash code for this URL object.
| |||||||||||
Creates a connection to this URL using the appropriate ProtocolHandler.
| |||||||||||
The method is the same as
openConnection() except that it
uses the proxy to establish a connection to this URL using
appropriate ProtocolHandler. | |||||||||||
Returns a stream for reading from this URL.
| |||||||||||
Returns true if the receiver and the argument refer to the same file.
| |||||||||||
Sets the URL Stream (protocol) handler factory.
| |||||||||||
Create and return the String representation of this URL.
| |||||||||||
Returns a string containing a concise, human-readable description of the
receiver.
| |||||||||||
Creates a URI related with this URL
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Sets the properties of this URL using the provided arguments.
| |||||||||||
Sets the properties of this URL using the provided arguments.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
Constructs a new URL instance by parsing the specification.
| spec | java.lang.String a URL specification. |
|---|
| MalformedURLException | if the spec could not be parsed as an URL. |
|---|
Constructs a new URL by parsing the specification given by
spec and using the context provided by
context.
The protocol of the specification is obtained by parsing the
spec string.
If the spec does not specify a protocol:
null, then a
MalformedURLException.null, then the protocol is
obtained from the context.spec does specify a protocol:
null, or specifies a different
protocol than the spec, the context is ignored.null and specifies the same
protocol as the specification, the properties of the new URL
are obtained from the context.| context | java.net.URL URL to use as context. |
|---|---|
| spec | java.lang.String a URL specification. |
| MalformedURLException | if the spec could not be parsed as an URL. |
|---|
Constructs a new URL by parsing the specification given by
spec and using the context provided by
context.
If the handler argument is non-null, a security check is made to verify that user-defined protocol handlers can be specified.
The protocol of the specification is obtained by parsing the
spec string.
If the spec does not specify a protocol:
null, then a
MalformedURLException.null, then the protocol is
obtained from the context.spec does specify a protocol:
null, or specifies a different
protocol than the spec, the context is ignored.null and specifies the same
protocol as the specification, the properties of the new URL
are obtained from the context.| context | java.net.URL URL to use as context. |
|---|---|
| spec | java.lang.String a URL specification. |
| handler | java.net.URLStreamHandler a URLStreamHandler. |
| MalformedURLException | if the spec could not be parsed as an URL |
|---|
Constructs a new URL instance using the arguments provided.
| protocol | String the protocol for the URL. |
|---|---|
| host | String the name of the host. |
| file | the name of the resource. |
| MalformedURLException | if the parameters do not represent a valid URL. |
|---|
Constructs a new URL instance using the arguments provided.
| protocol | String the protocol for the URL. |
|---|---|
| host | String the name of the host. |
| port | int the port number. |
| file | String the name of the resource. |
| MalformedURLException | if the parameters do not represent a valid URL. |
|---|
Constructs a new URL instance using the arguments provided.
If the handler argument is non-null, a security check is made to verify that user-defined protocol handlers can be specified.
| protocol | the protocol for the URL. |
|---|---|
| host | the name of the host. |
| port | the port number. |
| file | the name of the resource. |
| handler | the stream handler that this URL uses. |
| MalformedURLException | if the parameters do not represent an URL. |
|---|
Compares the argument to the receiver, and returns true if they represent the same URL. Two URLs are equal if they have the same file, host, port, protocol, and reference components.
| o | the object to compare with this URL. |
|---|
true if the object is the same as this URL,
false otherwise.Returns the authority component of this URL.
Returns an Object representing the resource referenced by this URL.
| types | The list of acceptable content types |
|---|
| IOException | If an error occurred obtaining the content. |
|---|
Returns an Object representing the resource referenced by this URL.
| IOException | If an error occurred obtaining the content. |
|---|
Returns the default port for this URL as defined by the URLStreamHandler.
Returns the file component of this URL.
Returns the host component of this URL.
Returns the path component of this URL.
Returns the port component of this URL.
Returns the protocol component of this URL.
Returns the query component of this URL.
Returns the reference component of this URL.
Returns the user info component of this URL.
Returns a hash code for this URL object.
Creates a connection to this URL using the appropriate ProtocolHandler.
| IOException | if the connection to the URL is not possible. |
|---|
The method is the same as openConnection() except that it
uses the proxy to establish a connection to this URL using
appropriate ProtocolHandler.
| proxy | the proxy which is used to make the connection |
|---|
| IOException | thrown if an IO error occurs during connection establishment |
|---|---|
| SecurityException | thrown if a security manager is installed and it denies the permission to connect to the proxy. |
| IllegalArgumentException | thrown if the proxy is null or of an invalid type. |
| UnsupportedOperationException | thrown if the protocol handler doesn't support this method. |
Returns a stream for reading from this URL.
| IOException | if a stream could not be created. |
|---|
Returns true if the receiver and the argument refer to the same file. All components except the reference are compared.
| otherURL | URL to compare against. |
|---|
Sets the URL Stream (protocol) handler factory. This method can be invoked only once during an application's lifetime.
A security check is performed to verify that the current Policy allows the stream handler factory to be set.
| streamFactory | URLStreamHandlerFactory The factory to use for finding stream handlers. |
|---|
Create and return the String representation of this URL.
Returns a string containing a concise, human-readable description of the receiver.
Creates a URI related with this URL
| URISyntaxException | if this URL cannot format into URI |
|---|
Sets the properties of this URL using the provided arguments. This method
is used both within this class and by the URLStreamHandler
code.
| protocol | the new protocol. |
|---|---|
| host | the new host name. |
| port | the new port number. |
| authority | the new authority. |
| userInfo | the new user info. |
| path | the new path component. |
| query | the new query. |
| ref | the new reference. |
Sets the properties of this URL using the provided arguments. This method
is used both within this class and by the URLStreamHandler
code.
| protocol | the new protocol. |
|---|---|
| host | the new host name. |
| port | the new port number. |
| file | the new file component. |
| ref | the new reference. |