Creates a URL object from the specified
protocol, host, port
number, file, and handler. Specifying
a port number of -1 indicates that
the URL should use the default port for the protocol. Specifying
a handler of null indicates that the URL
should use a default stream handler for the protocol, as outlined
for:
java.net.URL#URL(java.lang.String, java.lang.String, int,
java.lang.String)
If the handler is not null and there is a security manager,
the security manager's checkPermission
method is called with a
NetPermission("specifyStreamHandler") permission.
This may result in a SecurityException.
No validation of the inputs is performed by this constructor.
protocol | the name of the protocol to use. | |
host | the name of the host. | |
port | the port number on the host. | |
file | the file on the host | |
handler | the stream handler for the URL. |
MalformedURLException | if an unknown protocol is specified. | |
SecurityException
| if a security manager exists and its
checkPermission method doesn't allow
specifying a stream handler explicitly. |
java.lang.System.getProperty(java.lang.String), java.net.URL.setURLStreamHandlerFactory(
java.net.URLStreamHandlerFactory), java.net.URLStreamHandler, java.net.URLStreamHandlerFactory.createURLStreamHandler(
java.lang.String), SecurityManager.checkPermission, java.net.NetPermission
Diagram: URL