    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class java.io.OutputStream

    java.lang.Object
       |
       +----java.io.OutputStream

public abstract class OutputStream
extends Object

This abstract class 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.

See Also:
  BufferedOutputStream, ByteArrayOutputStream, DataOutputStream, FilterOutputStream, InputStream, write

##

OutputStream()

##

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

##

OutputStream

     public OutputStream()

##

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
    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`.

  Parameters:
    b - the data.
  Throws: IOException
    if an I/O error occurs.
  See Also:
    write

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
    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
    if an I/O error occurs.

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
    if an I/O error occurs.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.