home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / OutputStream.java < prev    next >
Text File  |  1997-05-20  |  4KB  |  119 lines

  1. /*
  2.  * @(#)OutputStream.java    1.14 97/01/22
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.io;
  24.  
  25. /**
  26.  * This abstract class is the superclass of all classes representing 
  27.  * an output stream of bytes. 
  28.  * <p>
  29.  * Applications that need to define a subclass of 
  30.  * <code>OutputStream</code> must always provide at least a method 
  31.  * that writes one byte of output. 
  32.  *
  33.  * @author  Arthur van Hoff
  34.  * @version 1.14, 01/22/97
  35.  * @see     java.io.BufferedOutputStream
  36.  * @see     java.io.ByteArrayOutputStream
  37.  * @see     java.io.DataOutputStream
  38.  * @see     java.io.FilterOutputStream
  39.  * @see     java.io.InputStream
  40.  * @see     java.io.OutputStream#write(int)
  41.  * @since   JDK1.0
  42.  */
  43. public abstract class OutputStream {
  44.     /**
  45.      * Writes the specified byte to this output stream. 
  46.      * <p>
  47.      * Subclasses of <code>OutputStream</code> must provide an 
  48.      * implementation for this method. 
  49.      *
  50.      * @param      b   the <code>byte</code>.
  51.      * @exception  IOException  if an I/O error occurs.
  52.      * @since      JDK1.0
  53.      */
  54.     public abstract void write(int b) throws IOException;
  55.  
  56.     /**
  57.      * Writes <code>b.length</code> bytes from the specified byte array 
  58.      * to this output stream. 
  59.      * <p>
  60.      * The <code>write</code> method of <code>OutputStream</code> calls 
  61.      * the <code>write</code> method of three arguments with the three 
  62.      * arguments <code>b</code>, <code>0</code>, and 
  63.      * <code>b.length</code>. 
  64.      *
  65.      * @param      b   the data.
  66.      * @exception  IOException  if an I/O error occurs.
  67.      * @see        java.io.OutputStream#write(byte[], int, int)
  68.      * @since      JDK1.0
  69.      */
  70.     public void write(byte b[]) throws IOException {
  71.     write(b, 0, b.length);
  72.     }
  73.  
  74.     /**
  75.      * Writes <code>len</code> bytes from the specified byte array 
  76.      * starting at offset <code>off</code> to this output stream. 
  77.      * <p>
  78.      * The <code>write</code> method of <code>OutputStream</code> calls 
  79.      * the write method of one argument on each of the bytes to be 
  80.      * written out. Subclasses are encouraged to override this method and 
  81.      * provide a more efficient implementation. 
  82.      *
  83.      * @param      b     the data.
  84.      * @param      off   the start offset in the data.
  85.      * @param      len   the number of bytes to write.
  86.      * @exception  IOException  if an I/O error occurs.
  87.      * @since      JDK1.0
  88.      */
  89.     public void write(byte b[], int off, int len) throws IOException {
  90.     for (int i = 0 ; i < len ; i++) {
  91.         write(b[off + i]);
  92.     }
  93.     }
  94.  
  95.     /**
  96.      * Flushes this output stream and forces any buffered output bytes 
  97.      * to be written out. 
  98.      * <p>
  99.      * The <code>flush</code> method of <code>OutputStream</code> does nothing.
  100.      *
  101.      * @exception  IOException  if an I/O error occurs.
  102.      * @since      JDK1.0
  103.      */
  104.     public void flush() throws IOException {
  105.     }
  106.  
  107.     /**
  108.      * Closes this output stream and releases any system resources 
  109.      * associated with this stream. 
  110.      * <p>
  111.      * The <code>close</code> method of <code>OutputStream</code> does nothing.
  112.      *
  113.      * @exception  IOException  if an I/O error occurs.
  114.      * @since      JDK1.0
  115.      */
  116.     public void close() throws IOException {
  117.     }
  118. }
  119.