<!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:46 CEST 2005 -->
<TITLE>
DataInput (IM Profile)
</TITLE>

<META NAME="keywords" CONTENT="java.io.DataInput interface">

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

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="DataInput (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/DataInput.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;PREV CLASS&nbsp;
&nbsp;<A HREF="../../java/io/DataOutput.html" title="interface in java.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="DataInput.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">
java.io</FONT>
<BR>
Interface DataInput</H2>
<DL>
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A></DD>
</DL>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../java/io/DataInputStream.html" title="class in java.io">DataInputStream</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>DataInput</B></DL>

<P>
The <code>DataInput</code> interface provides
 for reading bytes from a binary stream and
 reconstructing from them data in any of
 the Java primitive types. There is also
 a
 facility for reconstructing a <code>String</code>
 from data in Java modified UTF-8 format.
 <p>
 It is generally true of all the reading
 routines in this interface that if end of
 file is reached before the desired number
 of bytes has been read, an <code>EOFException</code>
 (which is a kind of <code>IOException</code>)
 is thrown. If any byte cannot be read for
 any reason other than end of file, an <code>IOException</code>
 other than <code>EOFException</code> is
 thrown. In particular, an <code>IOException</code>
 may be thrown if the input stream has been
 closed.
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>JDK1.0, CLDC 1.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../java/io/DataInputStream.html" title="class in java.io"><CODE>DataInputStream</CODE></A>, 
<A HREF="../../java/io/DataOutput.html" title="interface in java.io"><CODE>DataOutput</CODE></A></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;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/io/DataInput.html#readBoolean()">readBoolean</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads one input byte and returns
 <code>true</code> if that byte is nonzero,
 <code>false</code> if that byte is zero.
 </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="../../java/io/DataInput.html#readByte()">readByte</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads and returns one input byte.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/io/DataInput.html#readChar()">readChar</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads an input <code>char</code> and returns the <code>char</code> value.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/io/DataInput.html#readDouble()">readDouble</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads eight input bytes and returns
 a <code>double</code> value. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;float</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/io/DataInput.html#readFloat()">readFloat</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads four input bytes and returns
 a <code>float</code> value. </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="../../java/io/DataInput.html#readFully(byte[])">readFully</A></B>(byte[]&nbsp;b)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads some bytes from an input
 stream and stores them into the buffer
 array <code>b</code>. </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="../../java/io/DataInput.html#readFully(byte[], int, int)">readFully</A></B>(byte[]&nbsp;b,
          int&nbsp;off,
          int&nbsp;len)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads <code>len</code>
 bytes from
 an input stream.
 </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="../../java/io/DataInput.html#readInt()">readInt</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads four input bytes and returns an
 <code>int</code> value. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/io/DataInput.html#readLong()">readLong</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads eight input bytes and returns
 a <code>long</code> value. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/io/DataInput.html#readShort()">readShort</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads two input bytes and returns
 a <code>short</code> value. </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="../../java/io/DataInput.html#readUnsignedByte()">readUnsignedByte</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads one input byte, zero-extends
 it to type <code>int</code>, and returns
 the result, which is therefore in the range
 <code>0</code>
 through <code>255</code>.
 </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="../../java/io/DataInput.html#readUnsignedShort()">readUnsignedShort</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads two input bytes, zero-extends
 it to type <code>int</code>, and returns
 an <code>int</code> value in the range <code>0</code>
 through <code>65535</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" title="class in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/io/DataInput.html#readUTF()">readUTF</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads in a string that has been encoded using a modified UTF-8 format.
 </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="../../java/io/DataInput.html#skipBytes(int)">skipBytes</A></B>(int&nbsp;n)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Makes an attempt to skip over <code>n</code> bytes
 of data from the input stream, discarding the skipped 
 bytes. </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="readFully(byte[])"><!-- --></A><H3>
readFully</H3>
<PRE>
public void <B>readFully</B>(byte[]&nbsp;b)
               throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads some bytes from an input
 stream and stores them into the buffer
 array <code>b</code>. The number of bytes
 read is equal
 to the length of <code>b</code>.
 <p>
 This method blocks until one of the
 following conditions occurs:<p>
 <ul>
 <li><code>b.length</code>
 bytes of input data are available, in which
 case a normal return is made.

 <li>End of file is detected, in which case 
 an <code>EOFException</code> is thrown.

 <li>An I/O error occurs, in which case an 
 <code>IOException</code> other than 
 <code>EOFException</code> is thrown.
 </ul>
 <p>
 If <code>b</code> is <code>null</code>,
 a <code>NullPointerException</code> is thrown.
 If <code>b.length</code> is zero, then
 no bytes are read. Otherwise, the first
 byte read is stored into element <code>b[0]</code>,
 the next one into <code>b[1]</code>, and
 so on.
 If an exception is thrown from
 this method, then it may be that some but
 not all bytes of <code>b</code> have been
 updated with data from the input stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the buffer into which the data is read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readFully(byte[], int, int)"><!-- --></A><H3>
readFully</H3>
<PRE>
public void <B>readFully</B>(byte[]&nbsp;b,
                      int&nbsp;off,
                      int&nbsp;len)
               throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads <code>len</code>
 bytes from
 an input stream.
 <p>
 This method
 blocks until one of the following conditions
 occurs:<p>
 <ul>
 <li><code>len</code> bytes
 of input data are available, in which case
 a normal return is made.

 <li>End of file
 is detected, in which case an <code>EOFException</code>
 is thrown.

 <li>An I/O error occurs, in
 which case an <code>IOException</code> other
 than <code>EOFException</code> is thrown.
 </ul>
 <p>
 If <code>b</code> is <code>null</code>,
 a <code>NullPointerException</code> is thrown.
 If <code>off</code> is negative, or <code>len</code>
 is negative, or <code>off+len</code> is
 greater than the length of the array <code>b</code>,
 then an <code>IndexOutOfBoundsException</code>
 is thrown.
 If <code>len</code> is zero,
 then no bytes are read. Otherwise, the first
 byte read is stored into element <code>b[off]</code>,
 the next one into <code>b[off+1]</code>,
 and so on. The number of bytes read is,
 at most, equal to <code>len</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the buffer into which the data is read.<DD><CODE>off</CODE> - an int specifying the offset into the data.<DD><CODE>len</CODE> - an int specifying the number of bytes to read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="skipBytes(int)"><!-- --></A><H3>
skipBytes</H3>
<PRE>
public int <B>skipBytes</B>(int&nbsp;n)
              throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Makes an attempt to skip over <code>n</code> bytes
 of data from the input stream, discarding the skipped 
 bytes. However, it may skip over some smaller number of
 bytes, possibly zero. This may result from any of a
 number of conditions; reaching end of file before 
 <code>n</code> bytes have been skipped is only one 
 possibility.
 This method never throws an <code>EOFException</code>.
 The actual number of bytes skipped is returned.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>n</CODE> - the number of bytes to be skipped.
<DT><B>Returns:</B><DD>the actual number of bytes skipped.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readBoolean()"><!-- --></A><H3>
readBoolean</H3>
<PRE>
public boolean <B>readBoolean</B>()
                    throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads one input byte and returns
 <code>true</code> if that byte is nonzero,
 <code>false</code> if that byte is zero.
 This method is suitable for reading
 the byte written by the <code>writeBoolean</code>
 method of interface <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the <code>boolean</code> value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readByte()"><!-- --></A><H3>
readByte</H3>
<PRE>
public byte <B>readByte</B>()
              throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads and returns one input byte.
 The byte is treated as a signed value in
 the range <code>-128</code> through <code>127</code>,
 inclusive.
 This method is suitable for
 reading the byte written by the <code>writeByte</code>
 method of interface <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the 8-bit value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readUnsignedByte()"><!-- --></A><H3>
readUnsignedByte</H3>
<PRE>
public int <B>readUnsignedByte</B>()
                     throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads one input byte, zero-extends
 it to type <code>int</code>, and returns
 the result, which is therefore in the range
 <code>0</code>
 through <code>255</code>.
 This method is suitable for reading
 the byte written by the <code>writeByte</code>
 method of interface <code>DataOutput</code>
 if the argument to <code>writeByte</code>
 was intended to be a value in the range
 <code>0</code> through <code>255</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the unsigned 8-bit value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readShort()"><!-- --></A><H3>
readShort</H3>
<PRE>
public short <B>readShort</B>()
                throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads two input bytes and returns
 a <code>short</code> value. Let <code>a</code>
 be the first byte read and <code>b</code>
 be the second byte. The value
 returned is:
 <p><pre><code>(short)((a &lt;&lt; 8) | (b &amp; 0xff))
 </code></pre>
 This method is suitable for reading the bytes
 written by the <code>writeShort</code> method of
 interface <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the 16-bit value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readUnsignedShort()"><!-- --></A><H3>
readUnsignedShort</H3>
<PRE>
public int <B>readUnsignedShort</B>()
                      throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads two input bytes, zero-extends
 it to type <code>int</code>, and returns
 an <code>int</code> value in the range <code>0</code>
 through <code>65535</code>. Let <code>a</code>
 be the first byte read and
 <code>b</code>
 be the second byte. The value returned is:
 <p><pre><code>(((a &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff))
 </code></pre>
 This method is suitable for reading the bytes
 written by the <code>writeShort</code> method
 of interface <code>DataOutput</code>  if
 the argument to <code>writeShort</code>
 was intended to be a value in the range
 <code>0</code> through <code>65535</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the unsigned 16-bit value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readChar()"><!-- --></A><H3>
readChar</H3>
<PRE>
public char <B>readChar</B>()
              throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads an input <code>char</code> and returns the <code>char</code> value.
 A Unicode <code>char</code> is made up of two bytes.
 Let <code>a</code>
 be the first byte read and <code>b</code>
 be the second byte. The value
 returned is:
 <p><pre><code>(char)((a &lt;&lt; 8) | (b &amp; 0xff))
 </code></pre>
 This method is suitable for reading bytes written by
 the <code>writeChar</code> method of interface
 <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the Unicode <code>char</code> read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readInt()"><!-- --></A><H3>
readInt</H3>
<PRE>
public int <B>readInt</B>()
            throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads four input bytes and returns an
 <code>int</code> value. Let <code>a</code>
 be the first byte read, <code>b</code> be
 the second byte, <code>c</code> be the third
 byte, and <code>d</code> be the fourth
 byte. The value returned is:
 <p><pre>
 <code>
 (((a &amp; 0xff) &lt;&lt; 24) | ((b &amp; 0xff) &lt;&lt; 16) |
 &#32;((c &amp; 0xff) &lt;&lt; 8) | (d &amp; 0xff))
 </code></pre>
 This method is suitable
 for reading bytes written by the <code>writeInt</code>
 method of interface <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the <code>int</code> value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readLong()"><!-- --></A><H3>
readLong</H3>
<PRE>
public long <B>readLong</B>()
              throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads eight input bytes and returns
 a <code>long</code> value. Let <code>a</code>
 be the first byte read, <code>b</code> be
 the second byte, <code>c</code> be the third
 byte, <code>d</code> be the fourth byte,
 <code>e</code> be the fifth byte, <code>f</code>
 be the sixth byte, <code>g</code> be the
 seventh byte, and <code>h</code> be the
 eighth byte. The value returned is:
 <p><pre> <code>
 (((long)(a &amp; 0xff) &lt;&lt; 56) |
  ((long)(b &amp; 0xff) &lt;&lt; 48) |
  ((long)(c &amp; 0xff) &lt;&lt; 40) |
  ((long)(d &amp; 0xff) &lt;&lt; 32) |
  ((long)(e &amp; 0xff) &lt;&lt; 24) |
  ((long)(f &amp; 0xff) &lt;&lt; 16) |
  ((long)(g &amp; 0xff) &lt;&lt;  8) |
  ((long)(h &amp; 0xff)))
 </code></pre>
 <p>
 This method is suitable
 for reading bytes written by the <code>writeLong</code>
 method of interface <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the <code>long</code> value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readFloat()"><!-- --></A><H3>
readFloat</H3>
<PRE>
public float <B>readFloat</B>()
                throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads four input bytes and returns
 a <code>float</code> value. It does this
 by first constructing an <code>int</code>
 value in exactly the manner
 of the <code>readInt</code>
 method, then converting this <code>int</code>
 value to a <code>float</code> in
 exactly the manner of the method <code>Float.intBitsToFloat</code>.
 This method is suitable for reading
 bytes written by the <code>writeFloat</code>
 method of interface <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the <code>float</code> value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.<DT><B>Since:</B></DT>
  <DD>CLDC 1.1</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="readDouble()"><!-- --></A><H3>
readDouble</H3>
<PRE>
public double <B>readDouble</B>()
                  throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads eight input bytes and returns
 a <code>double</code> value. It does this
 by first constructing a <code>long</code>
 value in exactly the manner
 of the <code>readlong</code>
 method, then converting this <code>long</code>
 value to a <code>double</code> in exactly
 the manner of the method <code>Double.longBitsToDouble</code>.
 This method is suitable for reading
 bytes written by the <code>writeDouble</code>
 method of interface <code>DataOutput</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>the <code>double</code> value read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.<DT><B>Since:</B></DT>
  <DD>CLDC 1.1</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="readUTF()"><!-- --></A><H3>
readUTF</H3>
<PRE>
public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>readUTF</B>()
               throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Reads in a string that has been encoded using a modified UTF-8 format.
 The general contract of <code>readUTF</code>
 is that it reads a representation of a Unicode
 character string encoded in Java modified
 UTF-8 format; this string of characters
 is then returned as a <code>String</code>.
 <p>
 First, two bytes are read and used to
 construct an unsigned 16-bit integer in
 exactly the manner of the <code>readUnsignedShort</code>
 method . This integer value is called the
 <i>UTF length</i> and specifies the number
 of additional bytes to be read. These bytes
 are then converted to characters by considering
 them in groups. The length of each group
 is computed from the value of the first
 byte of the group. The byte following a
 group, if any, is the first byte of the
 next group.
 <p>
 If the first byte of a group
 matches the bit pattern <code>0xxxxxxx</code>
 (where <code>x</code> means "may be <code>0</code>
 or <code>1</code>"), then the group consists
 of just that byte. The byte is zero-extended
 to form a character.
 <p>
 If the first byte
 of a group matches the bit pattern <code>110xxxxx</code>,
 then the group consists of that byte <code>a</code>
 and a second byte <code>b</code>. If there
 is no byte <code>b</code> (because byte
 <code>a</code> was the last of the bytes
 to be read), or if byte <code>b</code> does
 not match the bit pattern <code>10xxxxxx</code>,
 then a <code>UTFDataFormatException</code>
 is thrown. Otherwise, the group is converted
 to the character:<p>
 <pre><code>(char)(((a&amp; 0x1F) &lt;&lt; 6) | (b &amp; 0x3F))
 </code></pre>
 If the first byte of a group
 matches the bit pattern <code>1110xxxx</code>,
 then the group consists of that byte <code>a</code>
 and two more bytes <code>b</code> and <code>c</code>.
 If there is no byte <code>c</code> (because
 byte <code>a</code> was one of the last
 two of the bytes to be read), or either
 byte <code>b</code> or byte <code>c</code>
 does not match the bit pattern <code>10xxxxxx</code>,
 then a <code>UTFDataFormatException</code>
 is thrown. Otherwise, the group is converted
 to the character:<p>
 <pre><code>
 (char)(((a &amp; 0x0F) &lt;&lt; 12) | ((b &amp; 0x3F) &lt;&lt; 6) | (c &amp; 0x3F))
 </code></pre>
 If the first byte of a group matches the
 pattern <code>1111xxxx</code> or the pattern
 <code>10xxxxxx</code>, then a <code>UTFDataFormatException</code>
 is thrown.
 <p>
 If end of file is encountered
 at any time during this entire process,
 then an <code>EOFException</code> is thrown.
 <p>
 After every group has been converted to
 a character by this process, the characters
 are gathered, in the same order in which
 their corresponding groups were read from
 the input stream, to form a <code>String</code>,
 which is returned.
 <p>
 The <code>writeUTF</code>
 method of interface <code>DataOutput</code>
 may be used to write data that is suitable
 for reading by this method.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a Unicode string.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/io/EOFException.html" title="class in java.io">EOFException</A></CODE> - if this stream reaches the end
             before reading all the bytes.
<DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.
<DD><CODE><A HREF="../../java/io/UTFDataFormatException.html" title="class in java.io">UTFDataFormatException</A></CODE> - if the bytes do not represent a
             valid UTF-8 encoding of a string.</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/DataInput.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;PREV CLASS&nbsp;
&nbsp;<A HREF="../../java/io/DataOutput.html" title="interface in java.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="DataInput.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>
