/* * @(#)OutputStream.java 1.12 95/08/11 Arthur van Hoff * * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. Please refer to the file "copyright.html" * for further important copyright and licensing information. * * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ package java.io; /** * Abstract class representing an output stream of bytes. * All OutputStreams are based on this class. * @see InputStream * @see FilterOutputStream * @see BufferedOutputStream * @see DataOutputStream * @see ByteArrayOutputStream * @version 1.12, 11 Aug 1995 * @author Arthur van Hoff */ public abstract class OutputStream { /** * Writes a byte. This method will block until the byte is actually * written. * @param b the byte * @exception IOException If an I/O error has occurred. */ public abstract void write(int b) throws IOException; /** * Writes an array of bytes. This method will block until the bytes * are actually written. * @param b the data to be written * @exception IOException If an I/O error has occurred. */ public void write(byte b[]) throws IOException { write(b, 0, b.length); } /** * Writes a sub array of bytes. * @param b the data to be written * @param off the start offset in the data * @param len the number of bytes that are written * @exception IOException If an I/O error has occurred. */ public void write(byte b[], int off, int len) throws IOException { for (int i = 0 ; i < len ; i++) { write(b[off + i]); } } /** * Flushes the stream. This will write any buffered * output bytes. * @exception IOException If an I/O error has occurred. */ public void flush() throws IOException { } /** * Closes the stream. This method must be called * to release any resources associated with the * stream. * @exception IOException If an I/O error has occurred. */ public void close() throws IOException { } }