1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <!-- Generated by javadoc (build 1.5.0_09) on Tue Jan 08 20:46:02 GMT 2008 -->
7 OutputStream (leJOS NXT API documentation)
10 <META NAME="keywords" CONTENT="java.io.OutputStream class">
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
14 <SCRIPT type="text/javascript">
15 function windowTitle()
17 parent.document.title="OutputStream (leJOS NXT API documentation)";
25 <BODY BGCOLOR="white" onload="windowTitle();">
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="">
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> </TD>
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 <A HREF="../../java/io/IOException.html" title="class in java.io"><B>PREV CLASS</B></A>
55 <A HREF="../../java/io/Serializable.html" title="interface 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/OutputStream.html" target="_top"><B>FRAMES</B></A>
58 <A HREF="OutputStream.html" target="_top"><B>NO FRAMES</B></A>
59 <SCRIPT type="text/javascript">
62 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
67 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
84 <!-- ======== START OF CLASS DATA ======== -->
89 Class OutputStream</H2>
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 "><B>java.io.OutputStream</B>
95 <DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../lejos/nxt/comm/BTOutputStream.html" title="class in lejos.nxt.comm">BTOutputStream</A>, <A HREF="../../java/io/DataOutputStream.html" title="class in java.io">DataOutputStream</A>, <A HREF="../../java/io/FileOutputStream.html" title="class in java.io">FileOutputStream</A>, <A HREF="../../lejos/nxt/comm/USBOutputStream.html" title="class in lejos.nxt.comm">USBOutputStream</A></DD>
99 <DT><PRE>public abstract class <B>OutputStream</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></DL>
103 This abstract class is the superclass of all classes representing
104 an output stream of bytes. An output stream accepts output bytes
105 and sends them to some sink.
107 Applications that need to define a subclass of
108 <code>OutputStream</code> must always provide at least a method
109 that writes one byte of output.
114 <DT><B>Since:</B></DT>
116 <DT><B>Version:</B></DT>
117 <DD>1.23, 02/02/00</DD>
118 <DT><B>Author:</B></DT>
119 <DD>Arthur van Hoff</DD>
120 <DT><B>See Also:</B><DD><CODE>BufferedOutputStream</CODE>,
121 <CODE>ByteArrayOutputStream</CODE>,
122 <A HREF="../../java/io/DataOutputStream.html" title="class in java.io"><CODE>DataOutputStream</CODE></A>,
123 <CODE>FilterOutputStream</CODE>,
124 <A HREF="../../java/io/InputStream.html" title="class in java.io"><CODE>InputStream</CODE></A>,
125 <A HREF="../../java/io/OutputStream.html#write(int)"><CODE>write(int)</CODE></A></DL>
130 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
132 <A NAME="constructor_summary"><!-- --></A>
133 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
134 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
135 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
136 <B>Constructor Summary</B></FONT></TH>
138 <TR BGCOLOR="white" CLASS="TableRowColor">
139 <TD><CODE><B><A HREF="../../java/io/OutputStream.html#OutputStream()">OutputStream</A></B>()</CODE>
142 </TD>
146 <!-- ========== METHOD SUMMARY =========== -->
148 <A NAME="method_summary"><!-- --></A>
149 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
150 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
151 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
152 <B>Method Summary</B></FONT></TH>
154 <TR BGCOLOR="white" CLASS="TableRowColor">
155 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
156 <CODE> void</CODE></FONT></TD>
157 <TD><CODE><B><A HREF="../../java/io/OutputStream.html#close()">close</A></B>()</CODE>
160 Closes this output stream and releases any system resources
161 associated with this stream.</TD>
163 <TR BGCOLOR="white" CLASS="TableRowColor">
164 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
165 <CODE> void</CODE></FONT></TD>
166 <TD><CODE><B><A HREF="../../java/io/OutputStream.html#flush()">flush</A></B>()</CODE>
169 Flushes this output stream and forces any buffered output bytes
170 to be written out.</TD>
172 <TR BGCOLOR="white" CLASS="TableRowColor">
173 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
174 <CODE> void</CODE></FONT></TD>
175 <TD><CODE><B><A HREF="../../java/io/OutputStream.html#write(byte[])">write</A></B>(byte[] b)</CODE>
178 Writes <code>b.length</code> bytes from the specified byte array
179 to this output stream.</TD>
181 <TR BGCOLOR="white" CLASS="TableRowColor">
182 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
183 <CODE> void</CODE></FONT></TD>
184 <TD><CODE><B><A HREF="../../java/io/OutputStream.html#write(byte[], int, int)">write</A></B>(byte[] b,
189 Writes <code>len</code> bytes from the specified byte array
190 starting at offset <code>off</code> to this output stream.</TD>
192 <TR BGCOLOR="white" CLASS="TableRowColor">
193 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
194 <CODE>abstract void</CODE></FONT></TD>
195 <TD><CODE><B><A HREF="../../java/io/OutputStream.html#write(int)">write</A></B>(int b)</CODE>
198 Writes the specified byte to this output stream.</TD>
201 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
202 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
203 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
204 <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>
206 <TR BGCOLOR="white" CLASS="TableRowColor">
207 <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>
213 <!-- ========= CONSTRUCTOR DETAIL ======== -->
215 <A NAME="constructor_detail"><!-- --></A>
216 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
217 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
218 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
219 <B>Constructor Detail</B></FONT></TH>
223 <A NAME="OutputStream()"><!-- --></A><H3>
226 public <B>OutputStream</B>()</PRE>
230 <!-- ============ METHOD DETAIL ========== -->
232 <A NAME="method_detail"><!-- --></A>
233 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
234 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
235 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
236 <B>Method Detail</B></FONT></TH>
240 <A NAME="write(int)"><!-- --></A><H3>
243 public abstract void <B>write</B>(int b)
244 throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
246 <DD>Writes the specified byte to this output stream. The general
247 contract for <code>write</code> is that one byte is written
248 to the output stream. The byte to be written is the eight
249 low-order bits of the argument <code>b</code>. The 24
250 high-order bits of <code>b</code> are ignored.
252 Subclasses of <code>OutputStream</code> must provide an
253 implementation for this method.
256 <DT><B>Parameters:</B><DD><CODE>b</CODE> - the <code>byte</code>.
258 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs. In particular,
259 an <code>IOException</code> may be thrown if the
260 output stream has been closed.</DL>
265 <A NAME="write(byte[])"><!-- --></A><H3>
268 public void <B>write</B>(byte[] b)
269 throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
271 <DD>Writes <code>b.length</code> bytes from the specified byte array
272 to this output stream. The general contract for <code>write(b)</code>
273 is that it should have exactly the same effect as the call
274 <code>write(b, 0, b.length)</code>.
277 <DT><B>Parameters:</B><DD><CODE>b</CODE> - the data.
279 <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/OutputStream.html#write(byte[], int, int)"><CODE>write(byte[], int, int)</CODE></A></DL>
284 <A NAME="write(byte[], int, int)"><!-- --></A><H3>
287 public void <B>write</B>(byte[] b,
290 throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
292 <DD>Writes <code>len</code> bytes from the specified byte array
293 starting at offset <code>off</code> to this output stream.
294 The general contract for <code>write(b, off, len)</code> is that
295 some of the bytes in the array <code>b</code> are written to the
296 output stream in order; element <code>b[off]</code> is the first
297 byte written and <code>b[off+len-1]</code> is the last byte written
300 The <code>write</code> method of <code>OutputStream</code> calls
301 the write method of one argument on each of the bytes to be
302 written out. Subclasses are encouraged to override this method and
303 provide a more efficient implementation.
305 If <code>b</code> is <code>null</code>, a
306 <code>NullPointerException</code> is thrown.
308 If <code>off</code> is negative, or <code>len</code> is negative, or
309 <code>off+len</code> is greater than the length of the array
310 <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
313 <DT><B>Parameters:</B><DD><CODE>b</CODE> - the data.<DD><CODE>off</CODE> - the start offset in the data.<DD><CODE>len</CODE> - the number of bytes to write.
315 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs. In particular,
316 an <code>IOException</code> is thrown if the output
317 stream is closed.</DL>
322 <A NAME="flush()"><!-- --></A><H3>
325 public void <B>flush</B>()
326 throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
328 <DD>Flushes this output stream and forces any buffered output bytes
329 to be written out. The general contract of <code>flush</code> is
330 that calling it is an indication that, if any bytes previously
331 written have been buffered by the implementation of the output
332 stream, such bytes should immediately be written to their
333 intended destination.
335 The <code>flush</code> method of <code>OutputStream</code> does nothing.
340 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
345 <A NAME="close()"><!-- --></A><H3>
348 public void <B>close</B>()
349 throws <A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
351 <DD>Closes this output stream and releases any system resources
352 associated with this stream. The general contract of <code>close</code>
353 is that it closes the output stream. A closed stream cannot perform
354 output operations and cannot be reopened.
356 The <code>close</code> method of <code>OutputStream</code> does nothing.
361 <DD><CODE><A HREF="../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
364 <!-- ========= END OF CLASS DATA ========= -->
368 <!-- ======= START OF BOTTOM NAVBAR ====== -->
369 <A NAME="navbar_bottom"><!-- --></A>
370 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
371 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
373 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
374 <A NAME="navbar_bottom_firstrow"><!-- --></A>
375 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
376 <TR ALIGN="center" VALIGN="top">
377 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
378 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
379 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
380 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
381 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
382 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
383 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
387 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
393 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
394 <A HREF="../../java/io/IOException.html" title="class in java.io"><B>PREV CLASS</B></A>
395 <A HREF="../../java/io/Serializable.html" title="interface in java.io"><B>NEXT CLASS</B></A></FONT></TD>
396 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
397 <A HREF="../../index.html?java/io/OutputStream.html" target="_top"><B>FRAMES</B></A>
398 <A HREF="OutputStream.html" target="_top"><B>NO FRAMES</B></A>
399 <SCRIPT type="text/javascript">
402 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
407 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
414 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
415 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
416 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
417 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
420 <A NAME="skip-navbar_bottom"></A>
421 <!-- ======== END OF BOTTOM NAVBAR ======= -->