⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 url.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 4 页
字号:
 method is called with a  <code>NetPermission("specifyStreamHandler")</code> permission. This may result in a SecurityException.<DD><DL><DT><B>Parameters:</B><DD><CODE>protocol</CODE> - the name of the protocol to use.<DD><CODE>host</CODE> - the name of the host.<DD><CODE>port</CODE> - the port number on the host.<DD><CODE>file</CODE> - the file on the host<DD><CODE>handler</CODE> - the stream handler for the URL.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/MalformedURLException.html">MalformedURLException</A></CODE> - if an unknown protocol is specified.<DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its         <code>checkPermission</code> method doesn't allow         specifying a stream handler explicitly.<DT><B>See Also: </B><DD><A HREF="../../java/lang/System.html#getProperty(java.lang.String)"><CODE>System.getProperty(java.lang.String)</CODE></A>, <A HREF="../../java/net/URL.html#setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)"><CODE>setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)</CODE></A>, <A HREF="../../java/net/URLStreamHandler.html"><CODE>URLStreamHandler</CODE></A>, <A HREF="../../java/net/URLStreamHandlerFactory.html#createURLStreamHandler(java.lang.String)"><CODE>URLStreamHandlerFactory.createURLStreamHandler(java.lang.String)</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkPermission(java.security.Permission)"><CODE>SecurityManager.checkPermission(java.security.Permission)</CODE></A>, <A HREF="../../java/net/NetPermission.html"><CODE>NetPermission</CODE></A></DL></DD></DL><HR><A NAME="URL(java.lang.String)"><!-- --></A><H3>URL</H3><PRE>public <B>URL</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;spec)    throws <A HREF="../../java/net/MalformedURLException.html">MalformedURLException</A></PRE><DL><DD>Creates a <code>URL</code> object from the <code>String</code>  representation.  <p> This constructor is equivalent to a call to the two-argument  constructor with a <code>null</code> first argument.<DD><DL><DT><B>Parameters:</B><DD><CODE>spec</CODE> - the <code>String</code> to parse as a URL.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/MalformedURLException.html">MalformedURLException</A></CODE> - If the string specifies an               unknown protocol.<DT><B>See Also: </B><DD><A HREF="../../java/net/URL.html#URL(java.net.URL, java.lang.String)"><CODE>URL(java.net.URL, java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="URL(java.net.URL, java.lang.String)"><!-- --></A><H3>URL</H3><PRE>public <B>URL</B>(<A HREF="../../java/net/URL.html">URL</A>&nbsp;context,           <A HREF="../../java/lang/String.html">String</A>&nbsp;spec)    throws <A HREF="../../java/net/MalformedURLException.html">MalformedURLException</A></PRE><DL><DD>Creates a URL by parsing the given spec within a specified context.  The new URL is created from the given context URL and the spec argument as described in RFC2396 &quot;Uniform Resource Identifiers : Generic Syntax&quot; : <blockquote><pre>          &lt;scheme&gt;://&lt;authority&gt;&lt;path&gt;?&lt;query&gt;#&lt;fragment&gt; </pre></blockquote> The reference is parsed into the scheme, authority, path, query and fragment parts. If the path component is empty and the scheme, authority, and query components are undefined, then the new URL is a reference to the current document. Otherwise the any fragment and query parts present in the spec are used in the new URL.  If the scheme component is defined in the given spec and does not match the scheme of the context, then the new URL is created as an absolute URL based on the spec alone. Otherwise the scheme component is inherited from the context URL. If the authority component is present in the spec then the spec is treated as absolute and the spec authority and path will replace the context authority and path. If the authority component is absent in the spec then the authority of the new URL will be inherited from the context. If the spec's path component begins with a slash character &quot;/&quot; then the path is treated as absolute and the spec path replaces the context path. Otherwise the path is treated as a relative path and is appended to the context path. The path is canonicalized through the removal of directory changes made by occurences of &quot;..&quot; and &quot;.&quot;.  For a more detailed description of URL parsing, refer to RFC2396.<DD><DL><DT><B>Parameters:</B><DD><CODE>context</CODE> - the context in which to parse the specification.<DD><CODE>spec</CODE> - the <code>String</code> to parse as a URL.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/MalformedURLException.html">MalformedURLException</A></CODE> - if no protocol is specified, or an               unknown protocol is found.<DT><B>See Also: </B><DD><A HREF="../../java/net/URL.html#URL(java.lang.String, java.lang.String, int, java.lang.String)"><CODE>URL(java.lang.String, java.lang.String, int, java.lang.String)</CODE></A>, <A HREF="../../java/net/URLStreamHandler.html"><CODE>URLStreamHandler</CODE></A>, <A HREF="../../java/net/URLStreamHandler.html#parseURL(java.net.URL, java.lang.String, int, int)"><CODE>URLStreamHandler.parseURL(java.net.URL, java.lang.String, int, int)</CODE></A></DL></DD></DL><HR><A NAME="URL(java.net.URL, java.lang.String, java.net.URLStreamHandler)"><!-- --></A><H3>URL</H3><PRE>public <B>URL</B>(<A HREF="../../java/net/URL.html">URL</A>&nbsp;context,           <A HREF="../../java/lang/String.html">String</A>&nbsp;spec,           <A HREF="../../java/net/URLStreamHandler.html">URLStreamHandler</A>&nbsp;handler)    throws <A HREF="../../java/net/MalformedURLException.html">MalformedURLException</A></PRE><DL><DD>Creates a URL by parsing the given spec with the specified handler within a specified context. If the handler is null, the parsing occurs as with the two argument constructor.<DD><DL><DT><B>Parameters:</B><DD><CODE>context</CODE> - the context in which to parse the specification.<DD><CODE>spec</CODE> - the <code>String</code> to parse as a URL.<DD><CODE>handler</CODE> - the stream handler for the URL.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/MalformedURLException.html">MalformedURLException</A></CODE> - if no protocol is specified, or an               unknown protocol is found.<DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its         <code>checkPermission</code> method doesn't allow         specifying a stream handler.<DT><B>See Also: </B><DD><A HREF="../../java/net/URL.html#URL(java.lang.String, java.lang.String, int, java.lang.String)"><CODE>URL(java.lang.String, java.lang.String, int, java.lang.String)</CODE></A>, <A HREF="../../java/net/URLStreamHandler.html"><CODE>URLStreamHandler</CODE></A>, <A HREF="../../java/net/URLStreamHandler.html#parseURL(java.net.URL, java.lang.String, int, int)"><CODE>URLStreamHandler.parseURL(java.net.URL, java.lang.String, int, int)</CODE></A></DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)"><!-- --></A><H3>set</H3><PRE>protected void <B>set</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;protocol,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;host,                   int&nbsp;port,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;file,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;ref)</PRE><DL><DD>Sets the fields of the URL. This is not a public method so that  only URLStreamHandlers can modify URL fields. URLs are  otherwise constant.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>protocol</CODE> - the name of the protocol to use<DD><CODE>host</CODE> - the name of the host<DD><CODE>port</CODE> - the port number on the host<DD><CODE>file</CODE> - the file on the host<DD><CODE>ref</CODE> - the internal reference in the URL</DL></DD></DL><HR><A NAME="set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>set</H3><PRE>protected void <B>set</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;protocol,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;host,                   int&nbsp;port,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;authority,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;userInfo,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;path,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;query,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;ref)</PRE><DL><DD>Sets the specified 8 fields of the URL. This is not a public method so that only URLStreamHandlers can modify URL fields. URLs are otherwise constant.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>protocol</CODE> - the name of the protocol to use<DD><CODE>host</CODE> - the name of the host<DD><CODE>port</CODE> - the port number on the host<DD><CODE>authority</CODE> - the authority part for the url<DD><CODE>userInfo</CODE> - the username and password<DD><CODE>path</CODE> - the file on the host<DD><CODE>ref</CODE> - the internal reference in the URL<DD><CODE>query</CODE> - the query part of this URL</DL></DD></DL><HR><A NAME="getQuery()"><!-- --></A><H3>getQuery</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getQuery</B>()</PRE><DL><DD>Returns the query part of this <code>URL</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the query part of this <code>URL</code>.</DL></DD></DL><HR><A NAME="getPath()"><!-- --></A><H3>getPath</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getPath</B>()</PRE><DL><DD>Returns the path part of this <code>URL</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the path part of this <code>URL</code>.</DL></DD></DL><HR><A NAME="getUserInfo()"><!-- --></A><H3>getUserInfo</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getUserInfo</B>()</PRE><DL><DD>Returns the userInfo part of this <code>URL</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the userInfo part of this <code>URL</code>.</DL></DD></DL><HR><A NAME="getAuthority()"><!-- --></A><H3>getAuthority</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getAuthority</B>()</PRE><DL><DD>Returns the authority part of this <code>URL</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the authority part of this <code>URL</code>.</DL></DD></DL><HR><A NAME="getPort()"><!-- --></A><H3>getPort</H3><PRE>public int <B>getPort</B>()</PRE><DL><DD>Returns the port number of this <code>URL</code>. Returns -1 if the port is not set.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the port number</DL></DD></DL><HR><A NAME="getProtocol()"><!-- --></A><H3>getProtocol</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getProtocol</B>()</PRE><DL><DD>Returns the protocol name of this <code>URL</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the protocol of this <code>URL</code>.</DL></DD></DL><HR><A NAME="getHost()"><!-- --></A><H3>getHost</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getHost</B>()</PRE><DL><DD>Returns the host name of this <code>URL</code>, if applicable.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the host name of this <code>URL</code>.</DL></DD></DL><HR><A NAME="getFile()"><!-- --></A><H3>getFile</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getFile</B>()</PRE><DL><DD>Returns the file name of this <code>URL</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the file name of this <code>URL</code>.</DL></DD></DL><HR><A NAME="getRef()"><!-- --></A><H3>getRef</H3>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -