Packages  This Package  Prev  Next  Index  

§2.15 Class OutputStream

public  abstract  class  java.io.OutputStream
    extends  java.lang.Object  (I-§1.12)
{
        // Constructors
    public OutputStream();	§2.15.1

        // Methods
    public void close();	§2.15.2
    public void flush();	§2.15.3
    public void write(byte  b[]);	§2.15.4
    public void write(byte  b[], int  off, int  len);	§2.15.5
    public abstract void write(int  b);	§2.15.6
}
This class is an abstract class that is the superclass of all classes representing an output stream of bytes.

Applications that need to define a subclass of OutputStream must always provide at least a method that writes one byte of output (I-§2.15.6).


Constructors

OutputStream

public OutputStream()
The default constructor.

Methods

close

public void close() throws IOException
Closes this output stream and releases any system resources associated with this stream.
The close method of OutputStream does nothing.
Throws
IOException (I-§2.29)
If an I/O error occurs.

flush

public void flush() throws IOException
Flushes this output stream and forces any buffered output bytes to be written out.
The flush method of OutputStream does nothing.
Throws
IOException (I-§2.29)
If an I/O error occurs.

write

public void write(byte b[]) throws IOException
Writes b.length bytes from the specified byte array to this output stream.
The write method of OutputStream calls the write method of three arguments (I-§2.15.5) with the three arguments b, 0, and b.length.

Parameters:
b - the data
Throws
IOException (I-§2.29)
If an I/O error occurs.

write

public void write(byte b[], int off, int len) throws IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.
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.
Parameters:
b - the data
off - the start offset in the data
len - the number of bytes to write
Throws
IOException (I-§2.29)
If an I/O error occurs.

write

public abstract void write(int b) throws IOException
Writes the specified byte to this output stream.
Subclasses of OutputStream must provide an implementation for this method.
Parameters:
b - the byte
Throws
IOException (I-§2.29)
If an I/O error occurs.

Packages  This Package  Prev  Next  Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com