OutputStream

public abstract class OutputStream extends Object
implements Closeable Flushable
Known Direct Subclasses
Known Indirect Subclasses

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.

Public Constructor Summary

Public Method Summary

void
close()
Closes this output stream and releases any system resources associated with this stream.
void
flush()
Flushes this output stream and forces any buffered output bytes to be written out.
void
write(byte[] b)
Writes b.length bytes from the specified byte array to this output stream.
void
write(byte[] b, int off, int len)
Writes len bytes from the specified byte array starting at offset off to this output stream.
abstract void
write(int b)
Writes the specified byte to this output stream.

Inherited Method Summary

Public Constructors

public OutputStream ()

Public Methods

public void close ()

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.

Throws
IOException if an I/O error occurs.

public void flush ()

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