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

  1. /*
  2.  * @(#)FilterWriter.java    1.5 97/01/27
  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. /**
  27.  * Abstract class for writing filtered character streams.
  28.  *
  29.  * @version     1.5, 97/01/27
  30.  * @author    Mark Reinhold
  31.  * @since    JDK1.1
  32.  */
  33.  
  34. public abstract class FilterWriter extends Writer {
  35.  
  36.     /**
  37.      * The underlying character-output stream.
  38.      */
  39.     protected Writer out;
  40.  
  41.     /**
  42.      * Create a new filtered writer.
  43.      */
  44.     protected FilterWriter(Writer out) {
  45.     super(out);
  46.     this.out = out;
  47.     }
  48.  
  49.     /**
  50.      * Write a single character.
  51.      *
  52.      * @exception  IOException  If an I/O error occurs
  53.      */
  54.     public void write(int c) throws IOException {
  55.     out.write(c);
  56.     }
  57.  
  58.     /**
  59.      * Write a portion of an array of characters.
  60.      *
  61.      * @param  cbuf  Buffer of characters to be written
  62.      * @param  off   Offset from which to start reading characters
  63.      * @param  len   Number of characters to be written
  64.      *
  65.      * @exception  IOException  If an I/O error occurs
  66.      */
  67.     public void write(char cbuf[], int off, int len) throws IOException {
  68.     out.write(cbuf, off, len);
  69.     }
  70.  
  71.     /**
  72.      * Write a portion of a string.
  73.      *
  74.      * @param  str  String to be written
  75.      * @param  off  Offset from which to start reading characters
  76.      * @param  len  Number of characters to be written
  77.      *
  78.      * @exception  IOException  If an I/O error occurs
  79.      */
  80.     public void write(String str, int off, int len) throws IOException {
  81.     out.write(str, off, len);
  82.     }
  83.  
  84.     /**
  85.      * Flush the stream.
  86.      *
  87.      * @exception  IOException  If an I/O error occurs
  88.      */
  89.     public void flush() throws IOException {
  90.     out.flush();
  91.     }
  92.  
  93.     /**
  94.      * Close the stream.
  95.      *
  96.      * @exception  IOException  If an I/O error occurs
  97.      */
  98.     public void close() throws IOException {
  99.     out.close();
  100.     }
  101.  
  102. }
  103.