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

📄 datagrampacket.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 2 页
字号:
                      int&nbsp;offset,                      int&nbsp;length)</PRE><DL><DD>Constructs a <code>DatagramPacket</code> for receiving packets of  length <code>length</code>, specifying an offset into the buffer. <p> The <code>length</code> argument must be less than or equal to  <code>buf.length</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>buf</CODE> - buffer for holding the incoming datagram.<DD><CODE>offset</CODE> - the offset for the buffer<DD><CODE>length</CODE> - the number of bytes to read.<DT><B>Since: </B><DD>JDK1.2</DD></DL></DD></DL><HR><A NAME="DatagramPacket(byte[], int)"><!-- --></A><H3>DatagramPacket</H3><PRE>public <B>DatagramPacket</B>(byte[]&nbsp;buf,                      int&nbsp;length)</PRE><DL><DD>Constructs a <code>DatagramPacket</code> for receiving packets of  length <code>length</code>.  <p> The <code>length</code> argument must be less than or equal to  <code>buf.length</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>buf</CODE> - buffer for holding the incoming datagram.<DD><CODE>length</CODE> - the number of bytes to read.</DL></DD></DL><HR><A NAME="DatagramPacket(byte[], int, int, java.net.InetAddress, int)"><!-- --></A><H3>DatagramPacket</H3><PRE>public <B>DatagramPacket</B>(byte[]&nbsp;buf,                      int&nbsp;offset,                      int&nbsp;length,                      <A HREF="../../java/net/InetAddress.html">InetAddress</A>&nbsp;address,                      int&nbsp;port)</PRE><DL><DD>Constructs a datagram packet for sending packets of length <code>length</code> with offset <code>ioffset</code>to the specified port number on the specified host. The <code>length</code> argument must be less than or equal to <code>buf.length</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>buf</CODE> - the packet data.<DD><CODE>offset</CODE> - the packet data offset.<DD><CODE>length</CODE> - the packet data length.<DD><CODE>address</CODE> - the destination address.<DD><CODE>port</CODE> - the destination port number.<DT><B>Since: </B><DD>JDK1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/net/InetAddress.html"><CODE>InetAddress</CODE></A></DL></DD></DL><HR><A NAME="DatagramPacket(byte[], int, java.net.InetAddress, int)"><!-- --></A><H3>DatagramPacket</H3><PRE>public <B>DatagramPacket</B>(byte[]&nbsp;buf,                      int&nbsp;length,                      <A HREF="../../java/net/InetAddress.html">InetAddress</A>&nbsp;address,                      int&nbsp;port)</PRE><DL><DD>Constructs a datagram packet for sending packets of length  <code>length</code> to the specified port number on the specified  host. The <code>length</code> argument must be less than or equal  to <code>buf.length</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>buf</CODE> - the packet data.<DD><CODE>length</CODE> - the packet length.<DD><CODE>address</CODE> - the destination address.<DD><CODE>port</CODE> - the destination port number.<DT><B>See Also: </B><DD><A HREF="../../java/net/InetAddress.html"><CODE>InetAddress</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="getAddress()"><!-- --></A><H3>getAddress</H3><PRE>public <A HREF="../../java/net/InetAddress.html">InetAddress</A> <B>getAddress</B>()</PRE><DL><DD>Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received.<DD><DL><DT><B>Returns:</B><DD>the IP address of the machine to which this datagram is being          sent or from which the datagram was received.<DT><B>See Also: </B><DD><A HREF="../../java/net/InetAddress.html"><CODE>InetAddress</CODE></A>, <A HREF="../../java/net/DatagramPacket.html#setAddress(java.net.InetAddress)"><CODE>setAddress(java.net.InetAddress)</CODE></A></DL></DD></DL><HR><A NAME="getPort()"><!-- --></A><H3>getPort</H3><PRE>public int <B>getPort</B>()</PRE><DL><DD>Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received.<DD><DL><DT><B>Returns:</B><DD>the port number on the remote host to which this datagram is          being sent or from which the datagram was received.<DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#setPort(int)"><CODE>setPort(int)</CODE></A></DL></DD></DL><HR><A NAME="getData()"><!-- --></A><H3>getData</H3><PRE>public byte[] <B>getData</B>()</PRE><DL><DD>Returns the data received or the data to be sent.<DD><DL><DT><B>Returns:</B><DD>the data received or the data to be sent.<DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#setData(byte[], int, int)"><CODE>setData(byte[], int, int)</CODE></A></DL></DD></DL><HR><A NAME="getOffset()"><!-- --></A><H3>getOffset</H3><PRE>public int <B>getOffset</B>()</PRE><DL><DD>Returns the offset of the data to be sent or the offset of the data received.<DD><DL><DT><B>Returns:</B><DD>the offset of the data to be sent or the offset of the          data received.<DT><B>Since: </B><DD>JDK1.2</DD></DL></DD></DL><HR><A NAME="getLength()"><!-- --></A><H3>getLength</H3><PRE>public int <B>getLength</B>()</PRE><DL><DD>Returns the length of the data to be sent or the length of the data received.<DD><DL><DT><B>Returns:</B><DD>the length of the data to be sent or the length of the          data received.<DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#setLength(int)"><CODE>setLength(int)</CODE></A></DL></DD></DL><HR><A NAME="setData(byte[], int, int)"><!-- --></A><H3>setData</H3><PRE>public void <B>setData</B>(byte[]&nbsp;buf,                    int&nbsp;offset,                    int&nbsp;length)</PRE><DL><DD>Set the data buffer for this packet. This sets the data, length and offset of the packet.<DD><DL><DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to set for this packet<DD><CODE>offset</CODE> - the offset into the data<DD><CODE>length</CODE> - the length of the data<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the argument is null<DT><B>Since: </B><DD>JDK1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#getData()"><CODE>getData()</CODE></A>, <A HREF="../../java/net/DatagramPacket.html#getOffset()"><CODE>getOffset()</CODE></A>, <A HREF="../../java/net/DatagramPacket.html#getLength()"><CODE>getLength()</CODE></A></DL></DD></DL><HR><A NAME="setAddress(java.net.InetAddress)"><!-- --></A><H3>setAddress</H3><PRE>public void <B>setAddress</B>(<A HREF="../../java/net/InetAddress.html">InetAddress</A>&nbsp;iaddr)</PRE><DL><DD>Sets the IP address of the machine to which this datagram is being sent.<DD><DL><DT><B>Parameters:</B><DD><CODE>iaddr</CODE> - the <code>InetAddress</code><DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#getAddress()"><CODE>getAddress()</CODE></A></DL></DD></DL><HR><A NAME="setPort(int)"><!-- --></A><H3>setPort</H3><PRE>public void <B>setPort</B>(int&nbsp;iport)</PRE><DL><DD>Sets the port number on the remote host to which this datagram is being sent.<DD><DL><DT><B>Parameters:</B><DD><CODE>iport</CODE> - the port number<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#setPort(int)"><CODE>setPort(int)</CODE></A></DL></DD></DL><HR><A NAME="setData(byte[])"><!-- --></A><H3>setData</H3><PRE>public void <B>setData</B>(byte[]&nbsp;buf)</PRE><DL><DD>Set the data buffer for this packet. If the length of the packet length is greater than the length of argument to this method, the length is reset to the the length of the argument.<DD><DL><DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to set for this packet.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the argument is null.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#getLength()"><CODE>getLength()</CODE></A>, <A HREF="../../java/net/DatagramPacket.html#getData()"><CODE>getData()</CODE></A></DL></DD></DL><HR><A NAME="setLength(int)"><!-- --></A><H3>setLength</H3><PRE>public void <B>setLength</B>(int&nbsp;length)</PRE><DL><DD>Set the length for this packet. The length of the packet is the number of bytes from the packet's data buffer that will be sent, or the number of bytes of the packet's data buffer that will be used for receiving data. The length must be lesser or equal to the length of the packet's buffer.<DD><DL><DT><B>Parameters:</B><DD><CODE>length</CODE> - the length to set for this packet.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the length is negative of if the length is greater than the packet's data buffer length.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/net/DatagramPacket.html#getLength()"><CODE>getLength()</CODE></A>, <A HREF="../../java/net/DatagramPacket.html#setData(byte[], int, int)"><CODE>setData(byte[], int, 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/DatagramPacket.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/ContentHandler.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/net/DatagramSocket.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="DatagramPacket.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><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 + -