📄 datainputstream.html
字号:
</DL><HR><A NAME="readShort()"><!-- --></A><H3>readShort</H3><PRE>public final short <B>readShort</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readShort</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readShort()">readShort</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next two bytes of this input stream, interpreted as a signed 16-bit number.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this input stream reaches the end before reading two bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/FilterInputStream.html#in"><CODE>FilterInputStream.in</CODE></A></DL></DD></DL><HR><A NAME="readUnsignedShort()"><!-- --></A><H3>readUnsignedShort</H3><PRE>public final int <B>readUnsignedShort</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readUnsignedShort</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readUnsignedShort()">readUnsignedShort</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next two bytes of this input stream, interpreted as an unsigned 16-bit integer.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this input stream reaches the end before reading two bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/FilterInputStream.html#in"><CODE>FilterInputStream.in</CODE></A></DL></DD></DL><HR><A NAME="readChar()"><!-- --></A><H3>readChar</H3><PRE>public final char <B>readChar</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readChar</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readChar()">readChar</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next two bytes of this input stream as a Unicode character.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this input stream reaches the end before reading two bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/FilterInputStream.html#in"><CODE>FilterInputStream.in</CODE></A></DL></DD></DL><HR><A NAME="readInt()"><!-- --></A><H3>readInt</H3><PRE>public final int <B>readInt</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readInt</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readInt()">readInt</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next four bytes of this input stream, interpreted as an <code>int</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this input stream reaches the end before reading four bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/FilterInputStream.html#in"><CODE>FilterInputStream.in</CODE></A></DL></DD></DL><HR><A NAME="readLong()"><!-- --></A><H3>readLong</H3><PRE>public final long <B>readLong</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readLong</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readLong()">readLong</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next eight bytes of this input stream, interpreted as a <code>long</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this input stream reaches the end before reading eight bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/FilterInputStream.html#in"><CODE>FilterInputStream.in</CODE></A></DL></DD></DL><HR><A NAME="readFloat()"><!-- --></A><H3>readFloat</H3><PRE>public final float <B>readFloat</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readFloat</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readFloat()">readFloat</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next four bytes of this input stream, interpreted as a <code>float</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this input stream reaches the end before reading four bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/DataInputStream.html#readInt()"><CODE>readInt()</CODE></A>, <A HREF="../../java/lang/Float.html#intBitsToFloat(int)"><CODE>Float.intBitsToFloat(int)</CODE></A></DL></DD></DL><HR><A NAME="readDouble()"><!-- --></A><H3>readDouble</H3><PRE>public final double <B>readDouble</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readDouble</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readDouble()">readDouble</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next eight bytes of this input stream, interpreted as a <code>double</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if this input stream reaches the end before reading eight bytes.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/DataInputStream.html#readLong()"><CODE>readLong()</CODE></A>, <A HREF="../../java/lang/Double.html#longBitsToDouble(long)"><CODE>Double.longBitsToDouble(long)</CODE></A></DL></DD></DL><HR><A NAME="readLine()"><!-- --></A><H3>readLine</H3><PRE>public final <A HREF="../../java/lang/String.html">String</A> <B>readLine</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD><B>Deprecated.</B> <I>This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the <code>BufferedReader.readLine()</code> method. Programs that use the <code>DataInputStream</code> class to read lines can be converted to use the <code>BufferedReader</code> class by replacing code of the form: <blockquote><pre> DataInputStream d = new DataInputStream(in); </pre></blockquote> with: <blockquote><pre> BufferedReader d = new BufferedReader(new InputStreamReader(in)); </pre></blockquote></I><P><DD>See the general contract of the <code>readLine</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readLine()">readLine</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the next line of text from this input stream.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also: </B><DD><A HREF="../../java/io/BufferedReader.html#readLine()"><CODE>BufferedReader.readLine()</CODE></A>, <A HREF="../../java/io/FilterInputStream.html#in"><CODE>FilterInputStream.in</CODE></A></DL></DD></DL><HR><A NAME="readUTF()"><!-- --></A><H3>readUTF</H3><PRE>public final <A HREF="../../java/lang/String.html">String</A> <B>readUTF</B>() throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>See the general contract of the <code>readUTF</code> method of <code>DataInput</code>. <p> Bytes for this operation are read from the contained input stream.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/io/DataInput.html#readUTF()">readUTF</A></CODE> in interface <CODE><A HREF="../../java/io/DataInput.html">DataInput</A></CODE></DL></DD><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 input 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.<DT><B>See Also: </B><DD><A HREF="../../java/io/DataInputStream.html#readUTF(java.io.DataInput)"><CODE>readUTF(java.io.DataInput)</CODE></A></DL></DD></DL><HR><A NAME="readUTF(java.io.DataInput)"><!-- --></A><H3>readUTF</H3><PRE>public static final <A HREF="../../java/lang/String.html">String</A> <B>readUTF</B>(<A HREF="../../java/io/DataInput.html">DataInput</A> in) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Reads from the stream <code>in</code> 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>. The details of the modified UTF-8 representation are exactly the same as for the <code>readUTF</code> method of <code>DataInput</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>in</CODE> - a data input stream.<DT><B>Returns:</B><DD>a Unicode string.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/EOFException.html">EOFException</A></CODE> - if the input stream reaches the end before 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 Unicode string.<DT><B>See Also: </B><DD><A HREF="../../java/io/DataInputStream.html#readUnsignedShort()"><CODE>readUnsignedShort()</CODE></A></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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="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="class-use/DataInputStream.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/io/CharArrayWriter.html"><B>PREV CLASS</B></A> <A HREF="../../java/io/DataOutputStream.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> <A HREF="DataInputStream.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#fields_inherited_from_class_java.io.FilterInputStream">FIELD</A> | <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><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -