Returns a
URLConnection
object that represents a connection to the remote object referred to by the
URL
.
A new connection is opened every time by calling the openConnection
method of the protocol handler for this URL.
If for the URL'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.
@return a URLConnection
to the URL.
@exception IOException if an I/O exception occurs.
@see java.net.URL#URL(java.lang.String,java.lang.String,int,java.lang.String)
@see java.net.URLConnection
@see java.net.URLStreamHandler#openConnection(java.net.URL)