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

📄 url.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:35 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  URL</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/URL.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/net/SocketPermission.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/net/URLClassLoader.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="URL.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.net</FONT><BR>Class  URL</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A>  |  +--<B>java.net.URL</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><HR><DL><DT>public final class <B>URL</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A><DT>implements <A HREF="../../java/io/Serializable.html">Serializable</A></DL><P>Class <code>URL</code> represents a Uniform Resource  Locator, a pointer to a "resource" on the World  Wide Web. A resource can be something as simple as a file or a  directory, or it can be a reference to a more complicated object,  such as a query to a database or to a search engine. More  information on the types of URLs and their formats can be found at: <blockquote><pre>     http://www.ncsa.uiuc.edu/demoweb/url-primer.html </pre></blockquote> <p> In general, a URL can be broken into several parts. The previous  example of a URL indicates that the protocol to use is  <code>http</code> (HyperText Transfer Protocol) and that the  information resides on a host machine named  <code>www.ncsa.uiuc.edu</code>. The information on that host  machine is named <code>/demoweb/url-primer.html</code>. The exact  meaning of this name on the host machine is both protocol  dependent and host dependent. The information normally resides in  a file, but it could be generated on the fly. This component of  the URL is called the <i>path</i> component. <p> A URL can optionally specify a "port", which is the  port number to which the TCP connection is made on the remote host  machine. If the port is not specified, the default port for  the protocol is used instead. For example, the default port for  <code>http</code> is <code>80</code>. An alternative port could be  specified as:  <blockquote><pre>     http://www.ncsa.uiuc.edu:8080/demoweb/url-primer.html </pre></blockquote> <p> A URL may have appended to it a "fragment", also known  as a "ref" or a "reference". The fragment is indicated by the sharp sign character "#" followed by more characters. For example,  <blockquote><pre>     http://java.sun.com/index.html#chapter1 </pre></blockquote> <p> This fragment is not technically part of the URL. Rather, it  indicates that after the specified resource is retrieved, the  application is specifically interested in that part of the  document that has the tag <code>chapter1</code> attached to it. The  meaning of a tag is resource specific.  <p> An application can also specify a "relative URL",  which contains only enough information to reach the resource  relative to another URL. Relative URLs are frequently used within  HTML pages. For example, if the contents of the URL: <blockquote><pre>     http://java.sun.com/index.html </pre></blockquote> contained within it the relative URL: <blockquote><pre>     FAQ.html </pre></blockquote> it would be a shorthand for: <blockquote><pre>     http://java.sun.com/FAQ.html </pre></blockquote> <p> The relative URL need not specify all the components of a URL. If  the protocol, host name, or port number is missing, the value is  inherited from the fully specified URL. The file component must be  specified. The optional fragment is not inherited.<P><DL><DT><B>Since: </B><DD>JDK1.0</DD><DT><B>See Also: </B><DD><A HREF="../../serialized-form.html#java.net.URL">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/net/URL.html#URL(java.lang.String)">URL</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;spec)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>URL</code> object from the <code>String</code>  representation.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/net/URL.html#URL(java.lang.String, java.lang.String, int, java.lang.String)">URL</A></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)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>URL</code> object from the specified  <code>protocol</code>, <code>host</code>, <code>port</code>  number, and <code>file</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/net/URL.html#URL(java.lang.String, java.lang.String, int, java.lang.String, java.net.URLStreamHandler)">URL</A></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/net/URLStreamHandler.html">URLStreamHandler</A>&nbsp;handler)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>URL</code> object from the specified  <code>protocol</code>, <code>host</code>, <code>port</code>  number, <code>file</code>, and <code>handler</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/net/URL.html#URL(java.lang.String, java.lang.String, java.lang.String)">URL</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;protocol,    <A HREF="../../java/lang/String.html">String</A>&nbsp;host,    <A HREF="../../java/lang/String.html">String</A>&nbsp;file)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a URL from the specified <code>protocol</code>  name, <code>host</code> name, and <code>file</code> name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/net/URL.html#URL(java.net.URL, java.lang.String)">URL</A></B>(<A HREF="../../java/net/URL.html">URL</A>&nbsp;context,    <A HREF="../../java/lang/String.html">String</A>&nbsp;spec)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a URL by parsing the given spec within a specified context.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../java/net/URL.html#URL(java.net.URL, java.lang.String, java.net.URLStreamHandler)">URL</A></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)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a URL by parsing the given spec with the specified handler within a specified context.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URL.html#equals(java.lang.Object)">equals</A></B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;obj)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares two URLs.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URL.html#getAuthority()">getAuthority</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the authority part of this <code>URL</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URL.html#getContent()">getContent</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the contents of this URL.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URL.html#getContent(java.lang.Class[])">getContent</A></B>(<A HREF="../../java/lang/Class.html">Class</A>[]&nbsp;classes)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the contents of this URL.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URL.html#getFile()">getFile</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the file name of this <code>URL</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URL.html#getHost()">getHost</A></B>()</CODE>

⌨️ 快捷键说明

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