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

📄 datainput.html

📁 是MIDP 的API 查詢文件, 大家可以看一下裡面的index.html, 再用Package 或 Class 名字來查.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
 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.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>n</CODE> - the number of bytes to be skipped.<DT><B>Returns:</B><DD>the number of bytes skipped, which is always <code>n</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/IOException.html">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">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>.<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">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">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">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>.<DD><DL>
<DT><B>Returns:</B><DD>the 8-bit value read.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">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">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>.<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">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">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">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>.<DD><DL>
<DT><B>Returns:</B><DD>the 16-bit value read.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">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">IOException</A></PRE>
<DL>
<DD>Reads two input bytes 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>.<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">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">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">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>.<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">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">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">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>.<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">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">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">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>.<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">EOFException</A></CODE> - if this stream reaches the end before reading             all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="readUTF()"><!-- --></A><H3>
readUTF</H3>
<PRE>
public <A HREF="../../java/lang/String.html">String</A> <B>readUTF</B>()               throws <A HREF="../../java/io/IOException.html">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.<DD><DL>
<DT><B>Returns:</B><DD>a Unicode string.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this stream reaches the end             before reading all the bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DD><CODE><A HREF="../../java/io/UTFDataFormatException.html">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 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/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>MID 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"><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></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="mailto:midp-feedback@risc.sps.mot.com">Submit a comment or suggestion</a> Version 2.0 of MID 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>

⌨️ 快捷键说明

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