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

📄 javaio.doc9.html

📁 java语言规范
💻 HTML
字号:
<html>
<head>
<title>The Java Language Specification The Package java.io </title>
</head>
<body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000>
 
<a href="index.html">Contents</a> | <a href="javaio.doc8.html">Prev</a> | <a href="javaio.doc10.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<hr><br>
 
<a name="28623"></a>
<center><h1>22.11  The Class  <code>java.io.DataInputStream</code></h1></center>
<a name="32348"></a>
A data input stream provides facilities for reading bytes from an input source and 
interpreting specific character sequences as representing data of diverse types.
<p><pre><a name="28624"></a>public class <code><b>DataInputStream</b></code> extends FilterInputStream
<a name="28625"></a>		implements DataInput {
<a name="28626"></a>	public <code><b>DataInputStream</b></code>(InputStream in);
<a name="28627"></a>	public final void <code><b>readFully</b></code>(byte[] b)
<a name="32349"></a>		throws IOException, NullPointerException;
<a name="28628"></a>	public final void <code><b>readFully</b></code>(byte[] b, int off, int len)
<a name="28629"></a>		throws IOException, NullPointerException,
<a name="32354"></a>			IndexOutOfBoundsException;
<a name="28630"></a>	public final int <code><b>skipBytes</b></code>(int n) throws IOException;
<a name="28631"></a>	public final boolean <code><b>readBoolean</b></code>() throws IOException;
<a name="28632"></a>	public final byte <code><b>readByte</b></code>() throws IOException;
<a name="28633"></a>	public final int <code><b>readUnsignedByte</b></code>() throws IOException;
<a name="28634"></a>	public final short <code><b>readShort</b></code>() throws IOException;
<a name="28635"></a>	public final int <code><b>readUnsignedShort</b></code>() throws IOException;
<a name="28636"></a>	public final char <code><b>readChar</b></code>() throws IOException;
<a name="28637"></a>	public final int <code><b>readInt</b></code>() throws IOException;
<a name="28638"></a>	public final long <code><b>readLong</b></code>() throws IOException;
<a name="28639"></a>	public final float <code><b>readFloat</b></code>() throws IOException;
<a name="28640"></a>	public final double <code><b>readDouble</b></code>() throws IOException;
<a name="28641"></a>	public final String <code><b>readLine</b></code>() throws IOException;
<a name="28642"></a>	public final String <code><b>readUTF</b></code>() throws IOException;
<a name="28643"></a>	public final static String <code><b>readUTF</b></code>(DataInput in)
<a name="28644"></a>		throws IOException;
<a name="28645"></a>}
</pre><a name="28646"></a>
<p><font size=+1><strong>22.11.1   </strong> <code>public <code><b>DataInputStream</b></code>(InputStream in)</code></font>
<p>
<a name="28647"></a>
This constructor initializes a newly created <code>DataInputStream</code> by saving its argument,
the input stream <code>in</code>, for later use.
<p><a name="28651"></a>
<p><font size=+1><strong>22.11.2   </strong> <code>public final void <code><b>readFully</b></code>(byte[] b)<br>throws IOException, NullPointerException</code></font>
<p>
<a name="28655"></a>
See the general contract of the <code>readFully</code> method of <code>DataInput</code> <a href="javaio.doc.html#28801">(&#167;22.1.1)</a>.
<p><a name="28656"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28657"></a>
<p><font size=+1><strong>22.11.3   </strong> <code>public final void <code><b>readFully</b></code>(byte[] b, int off, int len)<br>throws IOException, NullPointerException,  &#32; &#32; &#32;IndexOutOfBoundsException</code></font>
<p>
<a name="28661"></a>
See the general contract of the <code>readFully</code> method of <code>DataInput</code> <a href="javaio.doc.html#28807">(&#167;22.1.2)</a>.
<p><a name="28662"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28663"></a>
<p><font size=+1><strong>22.11.4   </strong> <code>public final int <code><b>skipBytes</b></code>(int n) throws IOException</code></font>
<p>
<a name="28667"></a>
See the general contract of the <code>skipBytes</code> method of <code>DataInput</code> <a href="javaio.doc.html#28814">(&#167;22.1.3)</a>.
<p><a name="28668"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28670"></a>
<p><font size=+1><strong>22.11.5   </strong> <code>public final boolean <code><b>readBoolean</b></code>() throws IOException</code></font>
<p>
<a name="28674"></a>
See the general contract of the <code>readBoolean</code> method of <code>DataInput</code> <a href="javaio.doc.html#28817">(&#167;22.1.4)</a>.
<p><a name="28675"></a>
The byte for this operation is read from the contained input stream.<p>
<a name="28677"></a>
<p><font size=+1><strong>22.11.6   </strong> <code>public final byte <code><b>readByte</b></code>() throws IOException</code></font>
<p>
<a name="28681"></a>
See the general contract of the <code>readByte</code> method of <code>DataInput</code> <a href="javaio.doc.html#28824">(&#167;22.1.5)</a>.
<p><a name="28682"></a>
The byte for this operation is read from the contained input stream.<p>
<a name="28683"></a>
<p><font size=+1><strong>22.11.7   </strong> <code>public final int <code><b>readUnsignedByte</b></code>() throws IOException</code></font>
<p>
<a name="28684"></a>
See the general contract of the <code>readUnsignedByte</code> method of <code>DataInput</code> 
<a href="javaio.doc.html#28831">(&#167;22.1.6)</a>.
<p><a name="28688"></a>
The byte for this operation is read from the contained input stream.<p>
<a name="28690"></a>
<p><font size=+1><strong>22.11.8   </strong> <code>public final short <code><b>readShort</b></code>() throws IOException</code></font>
<p>
<a name="28694"></a>
See the general contract of the <code>readShort</code> method of <code>DataInput</code> <a href="javaio.doc.html#28838">(&#167;22.1.7)</a>.
<p><a name="28695"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28696"></a>
<p><font size=+1><strong>22.11.9   </strong> <code>public final int <code><b>readUnsignedShort</b></code>() throws IOException</code></font>
<p>
<a name="28697"></a>
See the general contract of the <code>readUnsignedShort</code> method of <code>DataInput</code> 
<a href="javaio.doc20.html#29998">(&#167;22.1.8)</a>.
<p><a name="28701"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28703"></a>
<p><font size=+1><strong>22.11.10   </strong> <code>public final char <code><b>readChar</b></code>() throws IOException</code></font>
<p>
<a name="28707"></a>
See the general contract of the <code>readChar</code> method of <code>DataInput</code> <a href="javaio.doc.html#28853">(&#167;22.1.9)</a>.
<p><a name="28708"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28710"></a>
<p><font size=+1><strong>22.11.11   </strong> <code>public final int <code><b>readInt</b></code>() throws IOException</code></font>
<p>
<a name="28714"></a>
See the general contract of the <code>readInt</code> method of <code>DataInput</code> <a href="javaio.doc.html#28860">(&#167;22.1.10)</a>.
<p><a name="28715"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28717"></a>
<p><font size=+1><strong>22.11.12   </strong> <code>public final long <code><b>readLong</b></code>() throws IOException</code></font>
<p>
<a name="28721"></a>
See the general contract of the <code>readLong</code> method of <code>DataInput</code> <a href="javaio.doc.html#28871">(&#167;22.1.11)</a>.
<p><a name="28722"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28724"></a>
<p><font size=+1><strong>22.11.13   </strong> <code>public final float <code><b>readFloat</b></code>() throws IOException</code></font>
<p>
<a name="28728"></a>
See the general contract of the <code>readFloat</code> method of <code>DataInput</code> <a href="javaio.doc.html#28886">(&#167;22.1.12)</a>.
<p><a name="28729"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28731"></a>
<p><font size=+1><strong>22.11.14   </strong> <code>public final double <code><b>readDouble</b></code>() throws IOException</code></font>
<p>
<a name="28735"></a>
See the general contract of the <code>readDouble</code> method of <code>DataInput</code> <a href="javaio.doc.html#28899">(&#167;22.1.13)</a>.
<p><a name="28736"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28737"></a>
<p><font size=+1><strong>22.11.15   </strong> <code>public final String <code><b>readLine</b></code>() throws IOException</code></font>
<p>
<a name="28741"></a>
See the general contract of the <code>readLine</code> method of <code>DataInput</code> <a href="javaio.doc.html#28912">(&#167;22.1.14)</a>.
<p><a name="28742"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28744"></a>
<p><font size=+1><strong>22.11.16   </strong> <code>public final String <code><b>readUTF</b></code>() throws IOException</code></font>
<p>
<a name="28748"></a>
See the general contract of the <code>readUTF</code> method of <code>DataInput</code> <a href="javaio.doc.html#28916">(&#167;22.1.15)</a>.
<p><a name="28749"></a>
Bytes for this operation are read from the contained input stream.<p>
<a name="28750"></a>
<p><font size=+1><strong>22.11.17   </strong> <code>public final static String <code><b>readUTF</b></code>(DataInput in)<br>throws IOException</code></font>
<p>
<a name="32920"></a>
<strong></strong>The <code>readUTF</code> method 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> <a href="javaio.doc.html#28916">(&#167;22.1.15)</a>.
<p>

<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javaio.doc8.html">Prev</a> | <a href="javaio.doc10.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright &#169 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>

⌨️ 快捷键说明

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