OSDN Git Service

lejos_NXJ_win32_0_5_0beta.zip
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / docs / apidocs / java / io / DataInputStream.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.5.0_09) on Tue Jan 08 20:46:02 GMT 2008 -->
6 <TITLE>
7 DataInputStream (leJOS NXT API documentation)
8 </TITLE>
9
10 <META NAME="keywords" CONTENT="java.io.DataInputStream class">
11
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
13
14 <SCRIPT type="text/javascript">
15 function windowTitle()
16 {
17     parent.document.title="DataInputStream (leJOS NXT API documentation)";
18 }
19 </SCRIPT>
20 <NOSCRIPT>
21 </NOSCRIPT>
22
23 </HEAD>
24
25 <BODY BGCOLOR="white" onload="windowTitle();">
26
27
28 <!-- ========= START OF TOP NAVBAR ======= -->
29 <A NAME="navbar_top"><!-- --></A>
30 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32 <TR>
33 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34 <A NAME="navbar_top_firstrow"><!-- --></A>
35 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36   <TR ALIGN="center" VALIGN="top">
37   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44   </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
51
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;PREV CLASS&nbsp;
55 &nbsp;<A HREF="../../java/io/DataOutputStream.html" title="class in java.io"><B>NEXT CLASS</B></A></FONT></TD>
56 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57   <A HREF="../../index.html?java/io/DataInputStream.html" target="_top"><B>FRAMES</B></A>  &nbsp;
58 &nbsp;<A HREF="DataInputStream.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60   <!--
61   if(window==top) {
62     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
63   }
64   //-->
65 </SCRIPT>
66 <NOSCRIPT>
67   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
69
70
71 </FONT></TD>
72 </TR>
73 <TR>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
78 </TR>
79 </TABLE>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
82
83 <HR>
84 <!-- ======== START OF CLASS DATA ======== -->
85 <H2>
86 <FONT SIZE="-1">
87 java.io</FONT>
88 <BR>
89 Class DataInputStream</H2>
90 <PRE>
91 <A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
92   <IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../java/io/InputStream.html" title="class in java.io">java.io.InputStream</A>
93       <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>java.io.DataInputStream</B>
94 </PRE>
95 <HR>
96 <DL>
97 <DT><PRE>public class <B>DataInputStream</B><DT>extends <A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A></DL>
98 </PRE>
99
100 <P>
101 Reads java data types transmitted as bytes over an InputStream.
102 <P>
103
104 <P>
105 <HR>
106
107 <P>
108 <!-- =========== FIELD SUMMARY =========== -->
109
110 <A NAME="field_summary"><!-- --></A>
111 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
112 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
113 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
114 <B>Field Summary</B></FONT></TH>
115 </TR>
116 <TR BGCOLOR="white" CLASS="TableRowColor">
117 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
118 <CODE>protected &nbsp;<A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A></CODE></FONT></TD>
119 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#in">in</A></B></CODE>
120
121 <BR>
122 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
123 </TR>
124 </TABLE>
125 &nbsp;
126 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
127
128 <A NAME="constructor_summary"><!-- --></A>
129 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
130 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
131 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
132 <B>Constructor Summary</B></FONT></TH>
133 </TR>
134 <TR BGCOLOR="white" CLASS="TableRowColor">
135 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#DataInputStream(java.io.InputStream)">DataInputStream</A></B>(<A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A>&nbsp;in)</CODE>
136
137 <BR>
138 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
139 </TR>
140 </TABLE>
141 &nbsp;
142 <!-- ========== METHOD SUMMARY =========== -->
143
144 <A NAME="method_summary"><!-- --></A>
145 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
146 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
147 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
148 <B>Method Summary</B></FONT></TH>
149 </TR>
150 <TR BGCOLOR="white" CLASS="TableRowColor">
151 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
152 <CODE>&nbsp;void</CODE></FONT></TD>
153 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#close()">close</A></B>()</CODE>
154
155 <BR>
156 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Closes this input stream and releases any system resources associated
157  with the stream.</TD>
158 </TR>
159 <TR BGCOLOR="white" CLASS="TableRowColor">
160 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
161 <CODE>&nbsp;int</CODE></FONT></TD>
162 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#read()">read</A></B>()</CODE>
163
164 <BR>
165 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads the next byte of data from this input stream.</TD>
166 </TR>
167 <TR BGCOLOR="white" CLASS="TableRowColor">
168 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
169 <CODE>&nbsp;int</CODE></FONT></TD>
170 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#read(byte[])">read</A></B>(byte[]&nbsp;b)</CODE>
171
172 <BR>
173 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads some number of bytes from the input stream and stores them into
174  the buffer array <code>b</code>.</TD>
175 </TR>
176 <TR BGCOLOR="white" CLASS="TableRowColor">
177 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
178 <CODE>&nbsp;int</CODE></FONT></TD>
179 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#read(byte[], int, int)">read</A></B>(byte[]&nbsp;b,
180      int&nbsp;off,
181      int&nbsp;len)</CODE>
182
183 <BR>
184 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads up to <code>len</code> bytes of data from the input stream into
185  an array of bytes.</TD>
186 </TR>
187 <TR BGCOLOR="white" CLASS="TableRowColor">
188 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
189 <CODE>&nbsp;boolean</CODE></FONT></TD>
190 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#readBoolean()">readBoolean</A></B>()</CODE>
191
192 <BR>
193 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
194 </TR>
195 <TR BGCOLOR="white" CLASS="TableRowColor">
196 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
197 <CODE>&nbsp;byte</CODE></FONT></TD>
198 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#readByte()">readByte</A></B>()</CODE>
199
200 <BR>
201 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
202 </TR>
203 <TR BGCOLOR="white" CLASS="TableRowColor">
204 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
205 <CODE>&nbsp;char</CODE></FONT></TD>
206 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#readChar()">readChar</A></B>()</CODE>
207
208 <BR>
209 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
210 </TR>
211 <TR BGCOLOR="white" CLASS="TableRowColor">
212 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
213 <CODE>&nbsp;float</CODE></FONT></TD>
214 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#readFloat()">readFloat</A></B>()</CODE>
215
216 <BR>
217 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
218 </TR>
219 <TR BGCOLOR="white" CLASS="TableRowColor">
220 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
221 <CODE>&nbsp;int</CODE></FONT></TD>
222 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#readInt()">readInt</A></B>()</CODE>
223
224 <BR>
225 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
226 </TR>
227 <TR BGCOLOR="white" CLASS="TableRowColor">
228 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
229 <CODE>&nbsp;<A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
230 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#readLine()">readLine</A></B>()</CODE>
231
232 <BR>
233 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
234 </TR>
235 <TR BGCOLOR="white" CLASS="TableRowColor">
236 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
237 <CODE>&nbsp;short</CODE></FONT></TD>
238 <TD><CODE><B><A HREF="../../java/io/DataInputStream.html#readShort()">readShort</A></B>()</CODE>
239
240 <BR>
241 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
242 </TR>
243 </TABLE>
244 &nbsp;<A NAME="methods_inherited_from_class_java.io.InputStream"><!-- --></A>
245 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
246 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
247 <TH ALIGN="left"><B>Methods inherited from class java.io.<A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A></B></TH>
248 </TR>
249 <TR BGCOLOR="white" CLASS="TableRowColor">
250 <TD><CODE><A HREF="../../java/io/InputStream.html#available()">available</A>, <A HREF="../../java/io/InputStream.html#mark(int)">mark</A>, <A HREF="../../java/io/InputStream.html#markSupported()">markSupported</A>, <A HREF="../../java/io/InputStream.html#reset()">reset</A>, <A HREF="../../java/io/InputStream.html#skip(long)">skip</A></CODE></TD>
251 </TR>
252 </TABLE>
253 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
254 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
255 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
256 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
257 </TR>
258 <TR BGCOLOR="white" CLASS="TableRowColor">
259 <TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A></CODE></TD>
260 </TR>
261 </TABLE>
262 &nbsp;
263 <P>
264
265 <!-- ============ FIELD DETAIL =========== -->
266
267 <A NAME="field_detail"><!-- --></A>
268 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
269 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
270 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
271 <B>Field Detail</B></FONT></TH>
272 </TR>
273 </TABLE>
274
275 <A NAME="in"><!-- --></A><H3>
276 in</H3>
277 <PRE>
278 protected <A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A> <B>in</B></PRE>
279 <DL>
280 <DL>
281 </DL>
282 </DL>
283
284 <!-- ========= CONSTRUCTOR DETAIL ======== -->
285
286 <A NAME="constructor_detail"><!-- --></A>
287 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
288 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
289 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
290 <B>Constructor Detail</B></FONT></TH>
291 </TR>
292 </TABLE>
293
294 <A NAME="DataInputStream(java.io.InputStream)"><!-- --></A><H3>
295 DataInputStream</H3>
296 <PRE>
297 public <B>DataInputStream</B>(<A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A>&nbsp;in)</PRE>
298 <DL>
299 </DL>
300
301 <!-- ============ METHOD DETAIL ========== -->
302
303 <A NAME="method_detail"><!-- --></A>
304 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
305 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
306 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
307 <B>Method Detail</B></FONT></TH>
308 </TR>
309 </TABLE>
310
311 <A NAME="read()"><!-- --></A><H3>
312 read</H3>
313 <PRE>
314 public int <B>read</B>()
315          throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
316 <DL>
317 <DD>Reads the next byte of data from this input stream. The value 
318  byte is returned as an <code>int</code> in the range 
319  <code>0</code> to <code>255</code>. If no byte is available 
320  because the end of the stream has been reached, the value 
321  <code>-1</code> is returned. This method blocks until input data 
322  is available, the end of the stream is detected, or an exception 
323  is thrown. 
324  <p>
325  This method
326  simply performs <code>in.read()</code> and returns the result.
327 <P>
328 <DD><DL>
329 <DT><B>Specified by:</B><DD><CODE><A HREF="../../java/io/InputStream.html#read()">read</A></CODE> in class <CODE><A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A></CODE></DL>
330 </DD>
331 <DD><DL>
332
333 <DT><B>Returns:</B><DD>the next byte of data, or <code>-1</code> if the end of the
334              stream is reached.
335 <DT><B>Throws:</B>
336 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also:</B><DD><CODE>FilterInputStream.in</CODE></DL>
337 </DD>
338 </DL>
339 <HR>
340
341 <A NAME="read(byte[])"><!-- --></A><H3>
342 read</H3>
343 <PRE>
344 public final int <B>read</B>(byte[]&nbsp;b)
345                throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
346 <DL>
347 <DD><B>Description copied from class: <CODE><A HREF="../../java/io/InputStream.html#read(byte[])">InputStream</A></CODE></B></DD>
348 <DD>Reads some number of bytes from the input stream and stores them into
349  the buffer array <code>b</code>. The number of bytes actually read is
350  returned as an integer.  This method blocks until input data is
351  available, end of file is detected, or an exception is thrown.
352
353  <p> If <code>b</code> is <code>null</code>, a
354  <code>NullPointerException</code> is thrown.  If the length of
355  <code>b</code> is zero, then no bytes are read and <code>0</code> is
356  returned; otherwise, there is an attempt to read at least one byte. If
357  no byte is available because the stream is at end of file, the value
358  <code>-1</code> is returned; otherwise, at least one byte is read and
359  stored into <code>b</code>.
360
361  <p> The first byte read is stored into element <code>b[0]</code>, the
362  next one into <code>b[1]</code>, and so on. The number of bytes read is,
363  at most, equal to the length of <code>b</code>. Let <i>k</i> be the
364  number of bytes actually read; these bytes will be stored in elements
365  <code>b[0]</code> through <code>b[</code><i>k</i><code>-1]</code>,
366  leaving elements <code>b[</code><i>k</i><code>]</code> through
367  <code>b[b.length-1]</code> unaffected.
368
369  <p> If the first byte cannot be read for any reason other than end of
370  file, then an <code>IOException</code> is thrown. In particular, an
371  <code>IOException</code> is thrown if the input stream has been closed.
372
373  <p> The <code>read(b)</code> method for class <code>InputStream</code>
374  has the same effect as: <pre><code> read(b, 0, b.length) </code></pre>
375 <P>
376 <DD><DL>
377 <DT><B>Overrides:</B><DD><CODE><A HREF="../../java/io/InputStream.html#read(byte[])">read</A></CODE> in class <CODE><A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A></CODE></DL>
378 </DD>
379 <DD><DL>
380 <DT><B>Parameters:</B><DD><CODE>b</CODE> - the buffer into which the data is read.
381 <DT><B>Returns:</B><DD>the total number of bytes read into the buffer, or
382              <code>-1</code> is there is no more data because the end of
383              the stream has been reached.
384 <DT><B>Throws:</B>
385 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also:</B><DD><A HREF="../../java/io/InputStream.html#read(byte[], int, int)"><CODE>InputStream.read(byte[], int, int)</CODE></A></DL>
386 </DD>
387 </DL>
388 <HR>
389
390 <A NAME="read(byte[], int, int)"><!-- --></A><H3>
391 read</H3>
392 <PRE>
393 public final int <B>read</B>(byte[]&nbsp;b,
394                       int&nbsp;off,
395                       int&nbsp;len)
396                throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
397 <DL>
398 <DD><B>Description copied from class: <CODE><A HREF="../../java/io/InputStream.html#read(byte[], int, int)">InputStream</A></CODE></B></DD>
399 <DD>Reads up to <code>len</code> bytes of data from the input stream into
400  an array of bytes.  An attempt is made to read as many as
401  <code>len</code> bytes, but a smaller number may be read, possibly
402  zero. The number of bytes actually read is returned as an integer.
403
404  <p> This method blocks until input data is available, end of file is
405  detected, or an exception is thrown.
406
407  <p> If <code>b</code> is <code>null</code>, a
408  <code>NullPointerException</code> is thrown.
409
410  <p> If <code>off</code> is negative, or <code>len</code> is negative, or
411  <code>off+len</code> is greater than the length of the array
412  <code>b</code>, then an <code>IndexOutOfBoundsException</code> is
413  thrown.
414
415  <p> If <code>len</code> is zero, then no bytes are read and
416  <code>0</code> is returned; otherwise, there is an attempt to read at
417  least one byte. If no byte is available because the stream is at end of
418  file, the value <code>-1</code> is returned; otherwise, at least one
419  byte is read and stored into <code>b</code>.
420
421  <p> The first byte read is stored into element <code>b[off]</code>, the
422  next one into <code>b[off+1]</code>, and so on. The number of bytes read
423  is, at most, equal to <code>len</code>. Let <i>k</i> be the number of
424  bytes actually read; these bytes will be stored in elements
425  <code>b[off]</code> through <code>b[off+</code><i>k</i><code>-1]</code>,
426  leaving elements <code>b[off+</code><i>k</i><code>]</code> through
427  <code>b[off+len-1]</code> unaffected.
428
429  <p> In every case, elements <code>b[0]</code> through
430  <code>b[off]</code> and elements <code>b[off+len]</code> through
431  <code>b[b.length-1]</code> are unaffected.
432
433  <p> If the first byte cannot be read for any reason other than end of
434  file, then an <code>IOException</code> is thrown. In particular, an
435  <code>IOException</code> is thrown if the input stream has been closed.
436
437  <p> The <code>read(b,</code> <code>off,</code> <code>len)</code> method
438  for class <code>InputStream</code> simply calls the method
439  <code>read()</code> repeatedly. If the first such call results in an
440  <code>IOException</code>, that exception is returned from the call to
441  the <code>read(b,</code> <code>off,</code> <code>len)</code> method.  If
442  any subsequent call to <code>read()</code> results in a
443  <code>IOException</code>, the exception is caught and treated as if it
444  were end of file; the bytes read up to that point are stored into
445  <code>b</code> and the number of bytes read before the exception
446  occurred is returned.  Subclasses are encouraged to provide a more
447  efficient implementation of this method.
448 <P>
449 <DD><DL>
450 <DT><B>Overrides:</B><DD><CODE><A HREF="../../java/io/InputStream.html#read(byte[], int, int)">read</A></CODE> in class <CODE><A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A></CODE></DL>
451 </DD>
452 <DD><DL>
453 <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>
454                    at which the data is written.<DD><CODE>len</CODE> - the maximum number of bytes to read.
455 <DT><B>Returns:</B><DD>the total number of bytes read into the buffer, or
456              <code>-1</code> if there is no more data because the end of
457              the stream has been reached.
458 <DT><B>Throws:</B>
459 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.<DT><B>See Also:</B><DD><A HREF="../../java/io/InputStream.html#read()"><CODE>InputStream.read()</CODE></A></DL>
460 </DD>
461 </DL>
462 <HR>
463
464 <A NAME="readBoolean()"><!-- --></A><H3>
465 readBoolean</H3>
466 <PRE>
467 public final boolean <B>readBoolean</B>()
468                           throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
469 <DL>
470 <DD><DL>
471
472 <DT><B>Throws:</B>
473 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE></DL>
474 </DD>
475 </DL>
476 <HR>
477
478 <A NAME="readByte()"><!-- --></A><H3>
479 readByte</H3>
480 <PRE>
481 public final byte <B>readByte</B>()
482                     throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
483 <DL>
484 <DD><DL>
485
486 <DT><B>Throws:</B>
487 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE></DL>
488 </DD>
489 </DL>
490 <HR>
491
492 <A NAME="readShort()"><!-- --></A><H3>
493 readShort</H3>
494 <PRE>
495 public final short <B>readShort</B>()
496                       throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
497 <DL>
498 <DD><DL>
499
500 <DT><B>Throws:</B>
501 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE></DL>
502 </DD>
503 </DL>
504 <HR>
505
506 <A NAME="readInt()"><!-- --></A><H3>
507 readInt</H3>
508 <PRE>
509 public final int <B>readInt</B>()
510                   throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
511 <DL>
512 <DD><DL>
513
514 <DT><B>Throws:</B>
515 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE></DL>
516 </DD>
517 </DL>
518 <HR>
519
520 <A NAME="readChar()"><!-- --></A><H3>
521 readChar</H3>
522 <PRE>
523 public final char <B>readChar</B>()
524                     throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
525 <DL>
526 <DD><DL>
527
528 <DT><B>Throws:</B>
529 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE></DL>
530 </DD>
531 </DL>
532 <HR>
533
534 <A NAME="readFloat()"><!-- --></A><H3>
535 readFloat</H3>
536 <PRE>
537 public final float <B>readFloat</B>()
538                       throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
539 <DL>
540 <DD><DL>
541
542 <DT><B>Throws:</B>
543 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE></DL>
544 </DD>
545 </DL>
546 <HR>
547
548 <A NAME="readLine()"><!-- --></A><H3>
549 readLine</H3>
550 <PRE>
551 public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>readLine</B>()
552                 throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
553 <DL>
554 <DD><DL>
555
556 <DT><B>Throws:</B>
557 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE></DL>
558 </DD>
559 </DL>
560 <HR>
561
562 <A NAME="close()"><!-- --></A><H3>
563 close</H3>
564 <PRE>
565 public void <B>close</B>()
566            throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
567 <DL>
568 <DD><B>Description copied from class: <CODE><A HREF="../../java/io/InputStream.html#close()">InputStream</A></CODE></B></DD>
569 <DD>Closes this input stream and releases any system resources associated
570  with the stream.
571
572  <p> The <code>close</code> method of <code>InputStream</code> does
573  nothing.
574 <P>
575 <DD><DL>
576 <DT><B>Overrides:</B><DD><CODE><A HREF="../../java/io/InputStream.html#close()">close</A></CODE> in class <CODE><A HREF="../../java/io/InputStream.html" title="class in java.io">InputStream</A></CODE></DL>
577 </DD>
578 <DD><DL>
579
580 <DT><B>Throws:</B>
581 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
582 </DD>
583 </DL>
584 <!-- ========= END OF CLASS DATA ========= -->
585 <HR>
586
587
588 <!-- ======= START OF BOTTOM NAVBAR ====== -->
589 <A NAME="navbar_bottom"><!-- --></A>
590 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
591 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
592 <TR>
593 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
594 <A NAME="navbar_bottom_firstrow"><!-- --></A>
595 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
596   <TR ALIGN="center" VALIGN="top">
597   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
598   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
599   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
600   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
601   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
602   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
603   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
604   </TR>
605 </TABLE>
606 </TD>
607 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
608 </EM>
609 </TD>
610 </TR>
611
612 <TR>
613 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
614 &nbsp;PREV CLASS&nbsp;
615 &nbsp;<A HREF="../../java/io/DataOutputStream.html" title="class in java.io"><B>NEXT CLASS</B></A></FONT></TD>
616 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
617   <A HREF="../../index.html?java/io/DataInputStream.html" target="_top"><B>FRAMES</B></A>  &nbsp;
618 &nbsp;<A HREF="DataInputStream.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
619 &nbsp;<SCRIPT type="text/javascript">
620   <!--
621   if(window==top) {
622     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
623   }
624   //-->
625 </SCRIPT>
626 <NOSCRIPT>
627   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
628 </NOSCRIPT>
629
630
631 </FONT></TD>
632 </TR>
633 <TR>
634 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
635   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
636 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
637 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
638 </TR>
639 </TABLE>
640 <A NAME="skip-navbar_bottom"></A>
641 <!-- ======== END OF BOTTOM NAVBAR ======= -->
642
643 <HR>
644
645 </BODY>
646 </HTML>