📄 urlstreamhandler.html
字号:
<A NAME="URLStreamHandler()"><!-- --></A><H3>URLStreamHandler</H3><PRE>public <B>URLStreamHandler</B>()</PRE><DL></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="openConnection(java.net.URL)"><!-- --></A><H3>openConnection</H3><PRE>protected abstract <A HREF="../../java/net/URLConnection.html">URLConnection</A> <B>openConnection</B>(<A HREF="../../java/net/URL.html">URL</A> u) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Opens a connection to the object referenced by the <code>URL</code> argument. This method should be overridden by a subclass. <p>If for the handler'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.<DD><DL><DT><B>Parameters:</B><DD><CODE>u</CODE> - the URL that this connects to.<DT><B>Returns:</B><DD>a <code>URLConnection</code> object for the <code>URL</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs while opening the connection.</DL></DD></DL><HR><A NAME="parseURL(java.net.URL, java.lang.String, int, int)"><!-- --></A><H3>parseURL</H3><PRE>protected void <B>parseURL</B>(<A HREF="../../java/net/URL.html">URL</A> u, <A HREF="../../java/lang/String.html">String</A> spec, int start, int limit)</PRE><DL><DD>Parses the string representation of a <code>URL</code> into a <code>URL</code> object. <p> If there is any inherited context, then it has already been copied into the <code>URL</code> argument. <p> The <code>parseURL</code> method of <code>URLStreamHandler</code> parses the string representation as if it were an <code>http</code> specification. Most URL protocol families have a similar parsing. A stream protocol handler for a protocol that has a different syntax must override this routine.<DD><DL><DT><B>Parameters:</B><DD><CODE>u</CODE> - the <code>URL</code> to receive the result of parsing the spec.<DD><CODE>spec</CODE> - the <code>String</code> representing the URL that must be parsed.<DD><CODE>start</CODE> - the character index at which to begin parsing. This is just past the '<code>:</code>' (if there is one) that specifies the determination of the protocol name.<DD><CODE>limit</CODE> - the character position to stop parsing at. This is the end of the string or the position of the "<code>#</code>" character, if present. All information after the sharp sign indicates an anchor.</DL></DD></DL><HR><A NAME="getDefaultPort()"><!-- --></A><H3>getDefaultPort</H3><PRE>protected int <B>getDefaultPort</B>()</PRE><DL><DD>Returns the default port for a URL parsed by this handler. This method is meant to be overidden by handlers with default port numbers.<DD><DL><DT><B>Returns:</B><DD>the default port for a <code>URL</code> parsed by this handler.</DL></DD></DL><HR><A NAME="equals(java.net.URL, java.net.URL)"><!-- --></A><H3>equals</H3><PRE>protected boolean <B>equals</B>(<A HREF="../../java/net/URL.html">URL</A> u1, <A HREF="../../java/net/URL.html">URL</A> u2)</PRE><DL><DD>Provides the default equals calculation. May be overidden by handlers for other protocols that have different requirements for equals(). This method requires that none of its arguments is null. This is guaranteed by the fact that it is only called by java.net.URL class.<DD><DL><DT><B>Returns:</B><DD><tt>true</tt> if the two urls are considered equal, ie. they refer to the same fragment in the same file.</DL></DD></DL><HR><A NAME="hashCode(java.net.URL)"><!-- --></A><H3>hashCode</H3><PRE>protected int <B>hashCode</B>(<A HREF="../../java/net/URL.html">URL</A> u)</PRE><DL><DD>Provides the default hash calculation. May be overidden by handlers for other protocols that have different requirements for hashCode calculation.<DD><DL><DT><B>Returns:</B><DD>an <tt>int</tt> suitable for hash table indexing</DL></DD></DL><HR><A NAME="sameFile(java.net.URL, java.net.URL)"><!-- --></A><H3>sameFile</H3><PRE>protected boolean <B>sameFile</B>(<A HREF="../../java/net/URL.html">URL</A> u1, <A HREF="../../java/net/URL.html">URL</A> u2)</PRE><DL><DD>Compare two urls to see whether they refer to the same file, i.e., having the same protocol, host, port, and path. This method requires that none of its arguments is null. This is guaranteed by the fact that it is only called indirectly by java.net.URL class.<DD><DL><DT><B>Returns:</B><DD>true if u1 and u2 refer to the same file</DL></DD></DL><HR><A NAME="getHostAddress(java.net.URL)"><!-- --></A><H3>getHostAddress</H3><PRE>protected <A HREF="../../java/net/InetAddress.html">InetAddress</A> <B>getHostAddress</B>(<A HREF="../../java/net/URL.html">URL</A> u)</PRE><DL><DD>Get the IP address of our host. An empty host field or a DNS failure will result in a null return.<DD><DL><DT><B>Returns:</B><DD>an <code>InetAddress</code> representing the host IP address.</DL></DD></DL><HR><A NAME="hostsEqual(java.net.URL, java.net.URL)"><!-- --></A><H3>hostsEqual</H3><PRE>protected boolean <B>hostsEqual</B>(<A HREF="../../java/net/URL.html">URL</A> u1, <A HREF="../../java/net/URL.html">URL</A> u2)</PRE><DL><DD>Compares the host components of two URLs.<DD><DL><DT><B>Parameters:</B><DD><CODE>u1</CODE> - the URL of the first host to compare<DD><CODE>u2</CODE> - the URL of the second host to compare<DT><B>Returns:</B><DD><tt>true</tt> if and only if they are equal, <tt>false</tt> otherwise.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/UnknownHostException.html">UnknownHostException</A></CODE> - If an unknown host is found.</DL></DD></DL><HR><A NAME="toExternalForm(java.net.URL)"><!-- --></A><H3>toExternalForm</H3><PRE>protected <A HREF="../../java/lang/String.html">String</A> <B>toExternalForm</B>(<A HREF="../../java/net/URL.html">URL</A> u)</PRE><DL><DD>Converts a <code>URL</code> of a specific protocol to a <code>String</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>u</CODE> - the URL.<DT><B>Returns:</B><DD>a string representation of the <code>URL</code> argument.</DL></DD></DL><HR><A NAME="setURL(java.net.URL, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>setURL</H3><PRE>protected void <B>setURL</B>(<A HREF="../../java/net/URL.html">URL</A> u, <A HREF="../../java/lang/String.html">String</A> protocol, <A HREF="../../java/lang/String.html">String</A> host, int port, <A HREF="../../java/lang/String.html">String</A> authority, <A HREF="../../java/lang/String.html">String</A> userInfo, <A HREF="../../java/lang/String.html">String</A> path, <A HREF="../../java/lang/String.html">String</A> query, <A HREF="../../java/lang/String.html">String</A> ref)</PRE><DL><DD>Sets the fields of the <code>URL</code> argument to the indicated values. Only classes derived from URLStreamHandler are supposed to be able to call the set method on a URL.<DD><DL><DT><B>Parameters:</B><DD><CODE>u</CODE> - the URL to modify.<DD><CODE>protocol</CODE> - the protocol name.<DD><CODE>host</CODE> - the remote host value for the URL.<DD><CODE>port</CODE> - the port on the remote machine.<DD><CODE>authority</CODE> - the authority part for the URL.<DD><CODE>path</CODE> - the path component of the URL.<DD><CODE>query</CODE> - the query part for the URL.<DD><CODE>ref</CODE> - the reference.<DT><B>See Also: </B><DD><A HREF="../../java/net/URL.html#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)"><CODE>URL.set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="setURL(java.net.URL, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)"><!-- --></A><H3>setURL</H3><PRE>protected void <B>setURL</B>(<A HREF="../../java/net/URL.html">URL</A> u, <A HREF="../../java/lang/String.html">String</A> protocol, <A HREF="../../java/lang/String.html">String</A> host, int port, <A HREF="../../java/lang/String.html">String</A> file, <A HREF="../../java/lang/String.html">String</A> ref)</PRE><DL><DD><B>Deprecated.</B> <I>Use setURL(URL, String, String, int, String, String, String, String);</I><P><DD>Sets the fields of the <code>URL</code> argument to the indicated values. Only classes derived from URLStreamHandler are supposed to be able to call the set method on a URL.<DD><DL><DT><B>Parameters:</B><DD><CODE>u</CODE> - the URL to modify.<DD><CODE>protocol</CODE> - the protocol name. This value is ignored since 1.2.<DD><CODE>host</CODE> - the remote host value for the URL.<DD><CODE>port</CODE> - the port on the remote machine.<DD><CODE>file</CODE> - the file.<DD><CODE>ref</CODE> - the reference.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/URLStreamHandler.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/net/URLEncoder.html"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="URLStreamHandler.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -