// -*- c++ -*-

/*
 * Jakelib2 - General purpose C++ library
 * Copyright (C) 2001 Florian Wolff  (florian@donuz.de)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: OutputStream.h,v 1.17 2003/09/13 08:46:07 florian Exp $
 */

#ifndef INCLUDE_JAKELIB2_IO_OUTPUTSTREAM_H
# define INCLUDE_JAKELIB2_IO_OUTPUTSTREAM_H

namespace jakelib {
  namespace io {

    /**
     * This abstract class forms the base of the hierarchy of classes that 
     * write output as a stream of bytes.
     *
     * It provides a common set of methods
     * for writing bytes to stream. Subclasses implement and/or extend these
     * methods to write bytes in a particular manner or to a particular 
     * destination such as a file on disk or network connection.
     *
     * @class OutputStream
     * @version $Id: OutputStream.h,v 1.17 2003/09/13 08:46:07 florian Exp $
     * @author Florian 'Overflo' Wolff (florian@donuz.de)
     */
    class OutputStream : public jakelib::lang::Object
    {
    public:

      /**
       * Writes the specified byte value to this output stream.
       *
       * @param b The byte value to be written. Only the lower 8 bits
       *          are written, all remaining bits are ignored.
       */
      virtual void write(int b) = 0;

      /**
       * Writes a number of bytes to the output stream.
       *
       * @param b The byte array to be written.
       * @param offset Offset in byte array \a b.
       * @param len Number of bytes to be written.
       */
      virtual void write(jbyte* b, int offset, int len);

      /**
       * Closes the output stream.
       */
      virtual void close() = 0;
      
      JAKELIB_DECLARE_CLASS(OutputStream);
    };
  }
}
#endif

