<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_03) on Mon Oct 10 16:31:47 CEST 2005 -->
<TITLE>
Datagram (IM Profile)
</TITLE>

<META NAME="keywords" CONTENT="javax.microedition.io.Datagram interface">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="Datagram (IM Profile)";
}
</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <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/Datagram.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-all.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>
<strong>IM Profile</strong></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../javax/microedition/io/ContentConnection.html" title="interface in javax.microedition.io"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/microedition/io/DatagramConnection.html" title="interface in javax.microedition.io"><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="Datagram.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>

</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&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>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.microedition.io</FONT>
<BR>
Interface Datagram</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD><A HREF="../../../java/io/DataInput.html" title="interface in java.io">DataInput</A>, <A HREF="../../../java/io/DataOutput.html" title="interface in java.io">DataOutput</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>Datagram</B><DT>extends <A HREF="../../../java/io/DataInput.html" title="interface in java.io">DataInput</A>, <A HREF="../../../java/io/DataOutput.html" title="interface in java.io">DataOutput</A></DL>

<P>
This class defines an abstract interface for datagram packets.
 The implementations of this interface hold data to be 
 sent or received from a <code>DatagramConnection</code> object.
 <p>
 Since this is an interface class, the internal structure
 of the datagram packets is not defined here.  However, it is
 assumed that each implementation of this interface will
 provide the following fields / state variables (the actual 
 implementation and the names of these fields may vary):
 <ul>
 <li><i>buffer</i>: the internal buffer in which data is stored
 <li><i>offset</i>: the read/write offset for the internal buffer
 <li><i>length</i>: the length of the data in datagram packet
 <li><i>address</i>: the destination or source address
 <li><i>read/write pointer</i>: a pointer that is added to the
   <i>offset</i> to point to the current data location during a
   read or write operation
 </ul>
 <p>
 <strong>Reading and Writing</strong>
 <p>
 The <code>Datagram</code> interface extends interfaces 
 <code>DataInput</code> and <code>DataOutput</code> in order
 to provide a simple way to read and write binary data in and out of
 the datagram buffer instead of using <code>getData</code> and
 <code>setData</code> methods. Writing automatically increments
 <i>length</i> and reading will continue while the <i>read/write pointer</i>
 is less than <i>length</i>. Before any writing is done reset must be called.
 If <code>setData()</code> is to be used when reading or writing, any value
 for the <code>offset</code> parameter other than 0 is not supported.
 <p>
 For example to write to datagram:
 <pre>
    datagram = connection.newDatagram(max);

    // Reset prepares the datagram for writing new message.
    datagram.reset();

    // writeUTF automatically increases the datagram length.
    datagram.writeUTF("hello world");

    connection.send(datagram);
 </pre>
 For example to read from a datagram (single use only):
 <pre>
    datagram = connection.newDatagram(max);

    connection.receive(datagram);

    message = datagram.readUTF();
 </pre>
 <strong>Reusing Datagrams</strong>
 <p>
 It should be noted the <i>length</i> above is returned
 from <code>getLength</code> and can have different meanings at different
 times. When sending <i>length</i> is the number of bytes to send. Before
 receiving <i>length</i> is the maximum number of bytes to receive.
 After receiving <i>length</i> is the number of bytes that were received.
 So when reusing a datagram to receive after sending or receiving, length
 must be set back to the maximum using <code>setLength</code>.
 <pre>
    datagram = connection.newDatagram(max);

    while (notDone) {

        // The last receive in the loop changed the length
        // so put it back to the maximum length.
        datagram.setLength(max);
        connection.receive(datagram);

        data = datagram.getData();
        bytesReceived = datagram.getLength();

        // process datagram ...
    }
 </pre>
 When reading instead of using <code>getData</code> the <code>reset</code>
 method must be used.
 <pre>
    datagram = connection.newDatagram(max);

    while (notDone) {

        // The last read in the loop changed the read pointer
        // so reset the pointer.
        datagram.reset();
        datagram.setLength(max);
        connection.receive(datagram);

        message = datagram.readUTF(message);

        // process message ...
    }
 </pre>
 For example to reread a datagram:
 <pre>
    connection.receive(datagram);

    message = datagram.readUTF(message);

    len = datagram.getLength();

    datagram.reset();

    datagram.setLength(len);

    copy = datagram.readUTF(message);
 </pre>
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>CLDC 1.0</DD>
</DL>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->


<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<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;<A HREF="../../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#getAddress()">getAddress</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the address of the datagram.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#getData()">getData</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the contents of the data buffer.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#getLength()">getLength</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the length of the datagram.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#getOffset()">getOffset</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the offset.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#reset()">reset</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Zero the <code>read/write pointer</code> as well as the
 <code>offset</code> and <code>length</code> state variables.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#setAddress(javax.microedition.io.Datagram)">setAddress</A></B>(<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A>&nbsp;reference)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set datagram address, copying the address from another datagram.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#setAddress(java.lang.String)">setAddress</A></B>(<A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;addr)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set datagram address.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#setData(byte[], int, int)">setData</A></B>(byte[]&nbsp;buffer,
        int&nbsp;offset,
        int&nbsp;len)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the <code>buffer</code>, <code>offset</code> and <code>length</code>
 state variables.  </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/Datagram.html#setLength(int)">setLength</A></B>(int&nbsp;len)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the <code>length</code> state variable.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.io.DataInput"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from interface java.io.<A HREF="../../../java/io/DataInput.html" title="interface in java.io">DataInput</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../java/io/DataInput.html#readBoolean()">readBoolean</A>, <A HREF="../../../java/io/DataInput.html#readByte()">readByte</A>, <A HREF="../../../java/io/DataInput.html#readChar()">readChar</A>, <A HREF="../../../java/io/DataInput.html#readDouble()">readDouble</A>, <A HREF="../../../java/io/DataInput.html#readFloat()">readFloat</A>, <A HREF="../../../java/io/DataInput.html#readFully(byte[])">readFully</A>, <A HREF="../../../java/io/DataInput.html#readFully(byte[], int, int)">readFully</A>, <A HREF="../../../java/io/DataInput.html#readInt()">readInt</A>, <A HREF="../../../java/io/DataInput.html#readLong()">readLong</A>, <A HREF="../../../java/io/DataInput.html#readShort()">readShort</A>, <A HREF="../../../java/io/DataInput.html#readUnsignedByte()">readUnsignedByte</A>, <A HREF="../../../java/io/DataInput.html#readUnsignedShort()">readUnsignedShort</A>, <A HREF="../../../java/io/DataInput.html#readUTF()">readUTF</A>, <A HREF="../../../java/io/DataInput.html#skipBytes(int)">skipBytes</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.io.DataOutput"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from interface java.io.<A HREF="../../../java/io/DataOutput.html" title="interface in java.io">DataOutput</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../java/io/DataOutput.html#write(byte[])">write</A>, <A HREF="../../../java/io/DataOutput.html#write(byte[], int, int)">write</A>, <A HREF="../../../java/io/DataOutput.html#write(int)">write</A>, <A HREF="../../../java/io/DataOutput.html#writeBoolean(boolean)">writeBoolean</A>, <A HREF="../../../java/io/DataOutput.html#writeByte(int)">writeByte</A>, <A HREF="../../../java/io/DataOutput.html#writeChar(int)">writeChar</A>, <A HREF="../../../java/io/DataOutput.html#writeChars(java.lang.String)">writeChars</A>, <A HREF="../../../java/io/DataOutput.html#writeDouble(double)">writeDouble</A>, <A HREF="../../../java/io/DataOutput.html#writeFloat(float)">writeFloat</A>, <A HREF="../../../java/io/DataOutput.html#writeInt(int)">writeInt</A>, <A HREF="../../../java/io/DataOutput.html#writeLong(long)">writeLong</A>, <A HREF="../../../java/io/DataOutput.html#writeShort(int)">writeShort</A>, <A HREF="../../../java/io/DataOutput.html#writeUTF(java.lang.String)">writeUTF</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<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/lang/String.html" title="class in java.lang">String</A> <B>getAddress</B>()</PRE>
<DL>
<DD>Get the address of the datagram.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the address in string form, or null if no address was set<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/Datagram.html#setAddress(java.lang.String)"><CODE>setAddress(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getData()"><!-- --></A><H3>
getData</H3>
<PRE>
public byte[] <B>getData</B>()</PRE>
<DL>
<DD>Get the contents of the data buffer.
 <p>
 Depending on the implementation, this operation may return 
 the internal buffer or a copy of it.  However, the user
 must not assume that the contents of the internal data 
 buffer can be manipulated by modifying the data returned by
 this operation.  Rather, the <code>setData</code> operation
 should be used for changing the contents of the internal
 buffer.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the data buffer as a byte array<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/Datagram.html#setData(byte[], int, int)"><CODE>setData(byte[], int, int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getLength()"><!-- --></A><H3>
getLength</H3>
<PRE>
public int <B>getLength</B>()</PRE>
<DL>
<DD>Get the length of the datagram.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the length state variable<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/Datagram.html#setLength(int)"><CODE>setLength(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getOffset()"><!-- --></A><H3>
getOffset</H3>
<PRE>
public int <B>getOffset</B>()</PRE>
<DL>
<DD>Get the offset.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the offset state variable</DL>
</DD>
</DL>
<HR>

<A NAME="setAddress(java.lang.String)"><!-- --></A><H3>
setAddress</H3>
<PRE>
public void <B>setAddress</B>(<A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;addr)
                throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Set datagram address.
 <p>
 The actual addressing scheme is implementation-dependent.
 Please read the general comments on datagram addressing
 in <code>DatagramConnection.java</code>.
 <p>
 Note that if the address of a datagram is not specified, then 
 it defaults to that of the connection.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>addr</CODE> - the new target address as a URL
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the address is not valid
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if a some kind of I/O error occurs<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/Datagram.html#getAddress()"><CODE>getAddress()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setAddress(javax.microedition.io.Datagram)"><!-- --></A><H3>
setAddress</H3>
<PRE>
public void <B>setAddress</B>(<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A>&nbsp;reference)</PRE>
<DL>
<DD>Set datagram address, copying the address from another datagram.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>reference</CODE> - to the datagram whose address will be copied as
 the new target address for this datagram.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the address is not valid<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/Datagram.html#getAddress()"><CODE>getAddress()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setLength(int)"><!-- --></A><H3>
setLength</H3>
<PRE>
public void <B>setLength</B>(int&nbsp;len)</PRE>
<DL>
<DD>Set the <code>length</code> state variable.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>len</CODE> - the new length of the datagram
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the length or length plus offset
            fall outside the buffer<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/Datagram.html#getLength()"><CODE>getLength()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setData(byte[], int, int)"><!-- --></A><H3>
setData</H3>
<PRE>
public void <B>setData</B>(byte[]&nbsp;buffer,
                    int&nbsp;offset,
                    int&nbsp;len)</PRE>
<DL>
<DD>Set the <code>buffer</code>, <code>offset</code> and <code>length</code>
 state variables.  Depending on the implementation, this operation may 
 copy the buffer or just set the state variable <code>buffer</code>
 to the value of the <code>buffer</code> argument.  However,
 the user must not assume that the contents of the internal data
 buffer can be manipulated by modifying the buffer passed on to 
 this operation.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buffer</CODE> - the data buffer<DD><CODE>offset</CODE> - the offset into the data buffer<DD><CODE>len</CODE> - the length of the data in the buffer
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the length or offset
                or offset plus length fall outside the 
                buffer, or if the buffer parameter is invalid<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/Datagram.html#getData()"><CODE>getData()</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="reset()"><!-- --></A><H3>
reset</H3>
<PRE>
public void <B>reset</B>()</PRE>
<DL>
<DD>Zero the <code>read/write pointer</code> as well as the
 <code>offset</code> and <code>length</code> state variables.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <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/Datagram.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-all.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>
<strong>IM Profile</strong></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../javax/microedition/io/ContentConnection.html" title="interface in javax.microedition.io"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/microedition/io/DatagramConnection.html" title="interface in javax.microedition.io"><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="Datagram.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>

</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&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>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
<font size=\-1\><a href=\mailto:midp-feedback@risc.sps.mot.com\>Submit a comment or suggestion</a> Version 2.0 of IM Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems,  Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font>
</BODY>
</HTML>
