home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / java.z / OutputStream.java < prev    next >
Text File  |  1996-05-03  |  3KB  |  82 lines

  1. /*
  2.  * @(#)OutputStream.java    1.12 95/08/11 Arthur van Hoff
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package java.io;
  21.  
  22. /**
  23.  * Abstract class representing an output stream of bytes.
  24.  * All OutputStreams are based on this class.
  25.  * @see        InputStream
  26.  * @see        FilterOutputStream
  27.  * @see        BufferedOutputStream
  28.  * @see        DataOutputStream
  29.  * @see        ByteArrayOutputStream
  30.  * @version     1.12, 11 Aug 1995
  31.  * @author    Arthur van Hoff
  32.  */
  33. public abstract class OutputStream {
  34.     /**
  35.      * Writes a byte. This method will block until the byte is actually
  36.      * written.
  37.      * @param b    the byte
  38.      * @exception IOException If an I/O error has occurred.
  39.      */
  40.     public abstract void write(int b) throws IOException;
  41.  
  42.     /**
  43.      * Writes an array of bytes. This method will block until the bytes
  44.      * are actually written.
  45.      * @param b    the data to be written
  46.      * @exception IOException If an I/O error has occurred.
  47.      */
  48.     public void write(byte b[]) throws IOException {
  49.     write(b, 0, b.length);
  50.     }
  51.  
  52.     /**
  53.      * Writes a sub array of bytes. 
  54.      * @param b    the data to be written
  55.      * @param off    the start offset in the data
  56.      * @param len    the number of bytes that are written
  57.      * @exception IOException If an I/O error has occurred.
  58.      */
  59.     public void write(byte b[], int off, int len) throws IOException {
  60.     for (int i = 0 ; i < len ; i++) {
  61.         write(b[off + i]);
  62.     }
  63.     }
  64.  
  65.     /**
  66.      * Flushes the stream. This will write any buffered
  67.      * output bytes.
  68.      * @exception IOException If an I/O error has occurred.
  69.      */
  70.     public void flush() throws IOException {
  71.     }
  72.  
  73.     /**
  74.      * Closes the stream. This method must be called
  75.      * to release any resources associated with the
  76.      * stream.
  77.      * @exception IOException If an I/O error has occurred.
  78.      */
  79.     public void close() throws IOException {
  80.     }
  81. }
  82.