Using URLs
URLs contain many useful methods, including:
returns the protocol identifier component of the URL (ftp/http, e.g.).
returns the host name component of the URL.
returns the port number component of the URL (or -1 if not set).
returns the filename component of the URL.
returns the reference component of the URL.