java.net.URL (JDK 1.0)
This class represents a URL (a Uniform Resource Locator) and allows the data referred to by the URL to be downloaded. A URL may be specified as a single string or with separate protocol, host, port, and file specifications. Relative URLs may also be specified with a String and the URL object that it is relative to.
getFile(), getHost(), getPort(), getProtocol(), and getRef() return the various portions of the URL specified by a URL object. sameFile() determines whether a URL object refers to the same file as this one.
The data or object referred to by a URL may be downloaded from the Internet in three ways: through a URLConnection created with openConnection(), through an InputStream created by openStream(), or through getContent(), which returns the URL contents directly, if an appropriate ContentHandler can be found.
public final classURLextends Object implements Serializable { //Public ConstructorspublicURL(Stringprotocol, Stringhost, intport, Stringfile) throws MalformedURLException; publicURL(Stringprotocol, Stringhost, Stringfile) throws MalformedURLException; publicURL(Stringspec) throws MalformedURLException; publicURL(URLcontext, Stringspec) throws MalformedURLException; //Class Methodspublic static synchronized voidsetURLStreamHandlerFactory(URLStreamHandlerFactoryfac); //Public Instance Methodspublic booleanequals(Objectobj); //Overrides Objectpublic final ObjectgetContent() throws IOException; public StringgetFile(); public StringgetHost(); public intgetPort(); public StringgetProtocol(); public StringgetRef(); public inthashCode(); //Overrides Objectpublic URLConnectionopenConnection() throws IOException; public final InputStreamopenStream() throws IOException; public booleansameFile(URLother); public StringtoExternalForm(); public StringtoString(); //Overrides Object//Protected Instance Methodsprotected voidset(Stringprotocol, Stringhost, intport, Stringfile, Stringref); }
Passed To:
Applet.getAudioClip(), Applet.getImage(), Applet.play(), AppletContext.getAudioClip(), AppletContext.getImage(), AppletContext.showDocument(), HttpURLConnection(), Toolkit.getImage(), URL(), URL.sameFile(), URLConnection(), URLStreamHandler.openConnection(), URLStreamHandler.parseURL(), URLStreamHandler.setURL(), URLStreamHandler.toExternalForm()
Returned By:
Applet.getCodeBase(), Applet.getDocumentBase(), AppletStub.getCodeBase(), AppletStub.getDocumentBase(), Class.getResource(), ClassLoader.getResource(), ClassLoader.getSystemResource(), URLConnection.getURL()
Type Of:
URLConnection.url