Java Doc for OutputStream.java in  » 6.0-JDK-Core » io-nio » java » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » io nio » java.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.OutputStream

All known Subclasses:   java.io.ByteArrayOutputStream,  java.io.PipedOutputStream,  java.io.FileOutputStream,  java.io.ObjectOutputStream,  java.io.FilterOutputStream,
OutputStream
abstract public class OutputStream implements Closeable,Flushable(Code)
This abstract class is the superclass of all classes representing an output stream of bytes. An output stream accepts output bytes and sends them to some sink.

Applications that need to define a subclass of OutputStream must always provide at least a method that writes one byte of output.
author:
   Arthur van Hoff
version:
   1.36, 05/05/07
See Also:   java.io.BufferedOutputStream
See Also:   java.io.ByteArrayOutputStream
See Also:   java.io.DataOutputStream
See Also:   java.io.FilterOutputStream
See Also:   java.io.InputStream
See Also:   java.io.OutputStream.write(int)
since:
   JDK1.0





Method Summary
public  voidclose()
     Closes this output stream and releases any system resources associated with this stream.
public  voidflush()
     Flushes this output stream and forces any buffered output bytes to be written out.
abstract public  voidwrite(int b)
     Writes the specified byte to this output stream.
public  voidwrite(byte b)
     Writes b.length bytes from the specified byte array to this output stream.
public  voidwrite(byte b, int off, int len)
     Writes len bytes from the specified byte array starting at offset off to this output stream.



Method Detail
close
public void close() throws IOException(Code)
Closes this output stream and releases any system resources associated with this stream. The general contract of close is that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.

The close method of OutputStream does nothing.
exception:
  IOException - if an I/O error occurs.




flush
public void flush() throws IOException(Code)
Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

The flush method of OutputStream does nothing.
exception:
  IOException - if an I/O error occurs.




write
abstract public void write(int b) throws IOException(Code)
Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Subclasses of OutputStream must provide an implementation for this method.
Parameters:
  b - the byte.
exception:
  IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.




write
public void write(byte b) throws IOException(Code)
Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length).
Parameters:
  b - the data.
exception:
  IOException - if an I/O error occurs.
See Also:   java.io.OutputStream.write(byte[]intint)



write
public void write(byte b, int off, int len) throws IOException(Code)
Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

The write method of OutputStream calls the write method of one argument on each of the bytes to be written out. Subclasses are encouraged to override this method and provide a more efficient implementation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.
Parameters:
  b - the data.
Parameters:
  off - the start offset in the data.
Parameters:
  len - the number of bytes to write.
exception:
  IOException - if an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.