inputstream.html

来自「维信SDK文档。源码要求为至少5个C或Java源码」· HTML 代码 · 共 845 行 · 第 1/2 页

HTML
845
字号
 This method is suitable for reading bytes written by <A HREF="../../widsets/api/OutputStream.html#writeChar(char)"><CODE>OutputStream.writeChar(char)</CODE></A>.<P><DD><DL><DT><B>Returns:</B><DD>the Unicode <code>char</code> read.</DL></DD></DL><HR><A NAME="read(ByteArray)"><!-- --></A><H3>read</H3><PRE>       int <B>read</B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A>&nbsp;b)</PRE><DL><DD>Reads some number of bytes from the input stream and stores them into the buffer array <code>b</code>. The number of bytes actually read is returned as an integer.  This method blocks until input data is available, end of file is detected, or an exception is thrown.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>b</CODE> - the buffer into which the data is read.<DT><B>Returns:</B><DD>the total number of bytes read into the buffer, or             <code>-1</code> is there is no more data because the end of             the stream has been reached.</DL></DD></DL><HR><A NAME="read(ByteArray, int, int)"><!-- --></A><H3>read</H3><PRE>       int <B>read</B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A>&nbsp;b,                int&nbsp;off,                int&nbsp;len)</PRE><DL><DD>Reads up to <code>len</code> bytes of data from the input stream into an array of bytes.  An attempt is made to read as many as <code>len</code> bytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>b</CODE> - the buffer into which the data is read.<DD><CODE>off</CODE> - the start offset in array <code>b</code>                   at which the data is written.<DD><CODE>len</CODE> - the maximum number of bytes to read.<DT><B>Returns:</B><DD>the total number of bytes read into the buffer, or             <code>-1</code> if there is no more data because the end of             the stream has been reached.</DL></DD></DL><HR><A NAME="readFully(ByteArray)"><!-- --></A><H3>readFully</H3><PRE>       void <B>readFully</B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A>&nbsp;b)</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.</DL></DD></DL><HR><A NAME="readFully(ByteArray, int, int)"><!-- --></A><H3>readFully</H3><PRE>       void <B>readFully</B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A>&nbsp;b,                      int&nbsp;off,                      int&nbsp;len)</PRE><DL><DD>Reads <code>len</code> bytes from a 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.</DL></DD></DL><HR><A NAME="readInt()"><!-- --></A><H3>readInt</H3><PRE>       int <B>readInt</B>()</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  <A HREF="../../widsets/api/OutputStream.html#writeInt(int)"><CODE>OutputStream.writeInt(int)</CODE></A>.<P><DD><DL><DT><B>Returns:</B><DD>the <code>int</code> value read.</DL></DD></DL><HR><A NAME="readLong()"><!-- --></A><H3>readLong</H3><PRE>       long <B>readLong</B>()</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  <A HREF="../../widsets/api/OutputStream.html#writeLong(long)"><CODE>OutputStream.writeLong(long)</CODE></A>.<P><DD><DL><DT><B>Returns:</B><DD>the <code>long</code> value read.</DL></DD></DL><HR><A NAME="readShort()"><!-- --></A><H3>readShort</H3><PRE>       int <B>readShort</B>()</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  <A HREF="../../widsets/api/OutputStream.html#writeShort(int)"><CODE>OutputStream.writeShort(int)</CODE></A>.<P><DD><DL><DT><B>Returns:</B><DD>the 16-bit value read.</DL></DD></DL><HR><A NAME="readUnsignedByte()"><!-- --></A><H3>readUnsignedByte</H3><PRE>       int <B>readUnsignedByte</B>()</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  <A HREF="../../widsets/api/OutputStream.html#writeByte(int)"><CODE>OutputStream.writeByte(int)</CODE></A> 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.</DL></DD></DL><HR><A NAME="readUnsignedShort()"><!-- --></A><H3>readUnsignedShort</H3><PRE>       int <B>readUnsignedShort</B>()</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  <A HREF="../../widsets/api/OutputStream.html#writeShort(int)"><CODE>OutputStream.writeShort(int)</CODE></A> 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.</DL></DD></DL><HR><A NAME="readUTF()"><!-- --></A><H3>readUTF</H3><PRE>       <A HREF="../../widsets/api/String.html" title="class in ">String</A> <B>readUTF</B>()</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><DD><DL><DT><B>Returns:</B><DD>a Unicode string.</DL></DD></DL><HR><A NAME="readValue()"><!-- --></A><H3>readValue</H3><PRE>       <A HREF="../../widsets/api/Value.html" title="class in ">Value</A> <B>readValue</B>()</PRE><DL><DD>Reads a Value from input stream.<P><DD><DL><DT><B>Returns:</B><DD>Read value.</DL></DD></DL><HR><A NAME="skip(int)"><!-- --></A><H3>skip</H3><PRE>       int <B>skip</B>(int&nbsp;n)</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. 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 number of bytes skipped, which is always <code>n</code>.</DL></DD></DL><HR><A NAME="available()"><!-- --></A><H3>available</H3><PRE>       int <B>available</B>()</PRE><DL><DD>Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.  The next caller might be the same thread or another thread.<P><DD><DL><DT><B>Returns:</B><DD>the number of bytes that can be read from this input stream             without blocking.</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=2 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="../../widsets/api/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="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></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../widsets/api/Input.html" title="class in "><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../widsets/api/IntArray.html" title="class in "><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html?widsets/api/InputStream.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="InputStream.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;<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><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>

⌨️ 快捷键说明

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