Package java.io |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
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 .
public OutputStream()The default constructor.
public void close()throws IOExceptionCloses this output stream and releases any system resources associated with this stream.
The close method of OutputStream does nothing.
Throw:
If an I/O error occurs.
public void flush()throws IOExceptionFlushes this output stream and forces any buffered output bytes to be written out.
The flush method of OutputStream does nothing.
Throw:
If an I/O error occurs.
public void write(byte b[])throws IOExceptionWrites 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.
Parameter Description b the data Throw:
If an I/O error occurs.
public void write(byte b[], int off, int len)throws IOExceptionWrites 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.
Parameter Description b the data off the start offset in the data len the number of bytes to write Throw:
If an I/O error occurs.
public abstract void write(int b)throws IOExceptionWrites the specified byte to this output stream.
Subclasses of OutputStream must provide an implementation for this method.
Parameter Description b the byte Throw:
If an I/O error occurs.