Package java.io Previous
Previous
Java API
Java API
Index
Index
Next
Next

Class OutputStream

Constructors , Methods

public  abstract  class  java.io.OutputStream
    extends  java.lang.Object  
{
        // Constructors
    public OutputStream();	

        // Methods
    public void close();	
    public void flush();	
    public void write(byte  b[]);	
    public void write(byte  b[], int  off, int  len);	
    public abstract void write(int  b);	
}

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 .


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.

Throw:

IOException

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.

Throw:

IOException

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 with the three arguments b, 0, and b.length.

ParameterDescription
b the data

Throw:

IOException

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.

ParameterDescription
b the data
off the start offset in the data
len the number of bytes to write

Throw:

IOException

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.

ParameterDescription
b the byte

Throw:

IOException

If an I/O error occurs.



Top© 1996 Sun Microsystems, Inc. All rights reserved.