inputstream.html
来自「维信SDK文档。源码要求为至少5个C或Java源码」· HTML 代码 · 共 845 行 · 第 1/2 页
HTML
845 行
<!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.5.0_11) on Tue Oct 23 19:38:41 EEST 2007 --><TITLE>InputStream (Widsets API)</TITLE><META NAME="keywords" CONTENT="InputStream class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="InputStream (Widsets API)";}</SCRIPT><NOSCRIPT></NOSCRIPT></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=2 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="../../widsets/api/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../widsets/api/Input.html" title="class in "><B>PREV CLASS</B></A> <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> <A HREF="InputStream.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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"></FONT><BR>Class InputStream</H2><PRE> <IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../widsets/api/Object.html" title="class in ">Object</A> <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>InputStream</B></PRE><HR><DL><DT><PRE> class <B>InputStream</B><DT>extends <A HREF="../../widsets/api/Object.html" title="class in ">Object</A></DL></PRE><P>The <code>InputStream</code> class provides for reading bytes from a binary stream and reconstructing from them data in the primitive types. There is also a facility for reconstructing a <code>String</code> from data in Java modified UTF-8 format.<P><P><DL><DT><B>See Also:</B><DD><A HREF="../../widsets/api/OutputStream.html" title="class in "><CODE>OutputStream</CODE></A></DL><HR><P><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#InputStream(ByteArray)">InputStream</A></B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A> array)</CODE><BR> Creates a new InputStream that will read the contents of given ByteArray.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#available()">available</A></B>()</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#read()">read</A></B>()</CODE><BR> Reads the next byte of data from the input stream.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#read(ByteArray)">read</A></B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A> b)</CODE><BR> Reads some number of bytes from the 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> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#read(ByteArray, int, int)">read</A></B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A> b, int off, int len)</CODE><BR> Reads up to <code>len</code> bytes of data from the input stream into an array of bytes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readBoolean()">readBoolean</A></B>()</CODE><BR> 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> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readByte()">readByte</A></B>()</CODE><BR> Reads and returns one input byte.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> char</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readChar()">readChar</A></B>()</CODE><BR> 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> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readFully(ByteArray)">readFully</A></B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A> b)</CODE><BR> 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> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readFully(ByteArray, int, int)">readFully</A></B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A> b, int off, int len)</CODE><BR> Reads <code>len</code> bytes from a input stream.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readInt()">readInt</A></B>()</CODE><BR> 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> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readLong()">readLong</A></B>()</CODE><BR> 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> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readShort()">readShort</A></B>()</CODE><BR> 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> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readUnsignedByte()">readUnsignedByte</A></B>()</CODE><BR> 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> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readUnsignedShort()">readUnsignedShort</A></B>()</CODE><BR> Reads two input bytes 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> <A HREF="../../widsets/api/String.html" title="class in ">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readUTF()">readUTF</A></B>()</CODE><BR> 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> <A HREF="../../widsets/api/Value.html" title="class in ">Value</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#readValue()">readValue</A></B>()</CODE><BR> Reads a Value from input stream.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/InputStream.html#skip(int)">skip</A></B>(int n)</CODE><BR> Makes an attempt to skip over <code>n</code> bytes of data from the input stream, discarding the skipped bytes.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class <A HREF="../../widsets/api/Object.html" title="class in ">Object</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../widsets/api/Object.html#toString()">toString</A>, <A HREF="../../widsets/api/Object.html#equals(Object)">equals</A>, <A HREF="../../widsets/api/Object.html#hashCode()">hashCode</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from </B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>equals, getClass, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="InputStream(ByteArray)"><!-- --></A><H3>InputStream</H3><PRE> <B>InputStream</B>(<A HREF="../../widsets/api/ByteArray.html" title="class in ">ByteArray</A> array)</PRE><DL><DD>Creates a new InputStream that will read the contents of given ByteArray.<P><DL><DT><B>Parameters:</B><DD><CODE>array</CODE> - ByteArray to read.</DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="read()"><!-- --></A><H3>read</H3><PRE> int <B>read</B>()</PRE><DL><DD>Reads the next byte of data from the input stream. The value byte is returned as an <code>int</code> in the range <code>0</code> to <code>255</code>. If no byte is available because the end of the stream has been reached, the value <code>-1</code> is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.<P><DD><DL><DT><B>Returns:</B><DD>the next byte of data, or <code>-1</code> if the end of the stream is reached.</DL></DD></DL><HR><A NAME="readBoolean()"><!-- --></A><H3>readBoolean</H3><PRE> boolean <B>readBoolean</B>()</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 <A HREF="../../widsets/api/OutputStream.html#writeBoolean(boolean)"><CODE>OutputStream.writeBoolean(boolean)</CODE></A>.<P><DD><DL><DT><B>Returns:</B><DD>the <code>boolean</code> value read.</DL></DD></DL><HR><A NAME="readByte()"><!-- --></A><H3>readByte</H3><PRE> int <B>readByte</B>()</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 <A HREF="../../widsets/api/OutputStream.html#writeByte(int)"><CODE>OutputStream.writeByte(int)</CODE></A>.<P><DD><DL><DT><B>Returns:</B><DD>the 8-bit value read.</DL></DD></DL><HR><A NAME="readChar()"><!-- --></A><H3>readChar</H3><PRE> char <B>readChar</B>()</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 << 8) | (b & 0xff)) </code></pre>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?