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

📄 inetaddress.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<DT><B>Returns:</B><DD>a <code>boolean</code> indicating if the InetAddress is  an IP multicast address<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="getHostName()"><!-- --></A><H3>getHostName</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getHostName</B>()</PRE><DL><DD>Gets the host name for this IP address. <p>If there is a security manager, its <code>checkConnect</code> method is first called with the hostname and <code>-1</code>  as its arguments to see if the operation is allowed.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the host name for this IP address.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its    <code>checkConnect</code> method doesn't allow the operation .<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#checkConnect(java.lang.String, int)"><CODE>SecurityManager.checkConnect(java.lang.String, int)</CODE></A></DL></DD></DL><HR><A NAME="getAddress()"><!-- --></A><H3>getAddress</H3><PRE>public byte[] <B>getAddress</B>()</PRE><DL><DD>Returns the raw IP address of this <code>InetAddress</code> object. The result is in network byte order: the highest order byte of the address is in <code>getAddress()[0]</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the raw IP address of this object.</DL></DD></DL><HR><A NAME="getHostAddress()"><!-- --></A><H3>getHostAddress</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getHostAddress</B>()</PRE><DL><DD>Returns the IP address string "%d.%d.%d.%d".<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the raw IP address in a string format.<DT><B>Since: </B><DD>JDK1.0.2</DD></DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD>Returns a hashcode for this IP address.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a hash code value for this IP address.</DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;obj)</PRE><DL><DD>Compares this object against the specified object. The result is <code>true</code> if and only if the argument is not <code>null</code> and it represents the same IP address as this object. <p> Two instances of <code>InetAddress</code> represent the same IP address if the length of the byte arrays returned by <code>getAddress</code> is the same for both, and each of the array components is the same for the byte arrays.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object to compare against.<DT><B>Returns:</B><DD><code>true</code> if the objects are the same;          <code>false</code> otherwise.<DT><B>See Also: </B><DD><A HREF="../../java/net/InetAddress.html#getAddress()"><CODE>getAddress()</CODE></A></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>()</PRE><DL><DD>Converts this IP address to a <code>String</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a string representation of this IP address.</DL></DD></DL><HR><A NAME="getByName(java.lang.String)"><!-- --></A><H3>getByName</H3><PRE>public static <A HREF="../../java/net/InetAddress.html">InetAddress</A> <B>getByName</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;host)                             throws <A HREF="../../java/net/UnknownHostException.html">UnknownHostException</A></PRE><DL><DD>Determines the IP address of a host, given the host's name. The host name can either be a machine name, such as "<code>java.sun.com</code>", or a string representing its IP address, such as "<code>206.26.48.100</code>".<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>host</CODE> - the specified host, or <code>null</code> for the                    local host.<DT><B>Returns:</B><DD>an IP address for the given host name.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/UnknownHostException.html">UnknownHostException</A></CODE> - if no IP address for the               <code>host</code> could be found.</DL></DD></DL><HR><A NAME="getAllByName(java.lang.String)"><!-- --></A><H3>getAllByName</H3><PRE>public static <A HREF="../../java/net/InetAddress.html">InetAddress</A>[] <B>getAllByName</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;host)                                  throws <A HREF="../../java/net/UnknownHostException.html">UnknownHostException</A></PRE><DL><DD>Determines all the IP addresses of a host, given the host's name. The host name can either be a machine name, such as "<code>java.sun.com</code>", or a string representing its IP address, such as "<code>206.26.48.100</code>". <p>If there is a security manager and <code>host</code> is not  null and <code>host.length() </code> is not equal to zero, the security manager's <code>checkConnect</code> method is called with the hostname and <code>-1</code>  as its arguments to see if the operation is allowed.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>host</CODE> - the name of the host.<DT><B>Returns:</B><DD>an array of all the IP addresses for a given host name.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/UnknownHostException.html">UnknownHostException</A></CODE> - if no IP address for the               <code>host</code> could be found.<DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its                 <code>checkConnect</code> method doesn't allow the operation.<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#checkConnect(java.lang.String, int)"><CODE>SecurityManager.checkConnect(java.lang.String, int)</CODE></A></DL></DD></DL><HR><A NAME="getLocalHost()"><!-- --></A><H3>getLocalHost</H3><PRE>public static <A HREF="../../java/net/InetAddress.html">InetAddress</A> <B>getLocalHost</B>()                                throws <A HREF="../../java/net/UnknownHostException.html">UnknownHostException</A></PRE><DL><DD>Returns the local host. <p>If there is a security manager, its <code>checkConnect</code> method is called with the local host name and <code>-1</code>  as its arguments to see if the operation is allowed.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the IP address of the local host.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/net/UnknownHostException.html">UnknownHostException</A></CODE> - if no IP address for the               <code>host</code> could be found.<DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its                 <code>checkConnect</code> method doesn't allow the operation.<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#checkConnect(java.lang.String, int)"><CODE>SecurityManager.checkConnect(java.lang.String, int)</CODE></A></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>&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/InetAddress.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/HttpURLConnection.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/net/JarURLConnection.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="InetAddress.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;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<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 + -