.. oe:namespace:: OEPlatform



.. meta::
   :keywords: oeostream, ostream


.. _OEPlatform_oeostream:

.. oe:class:: oeostream

   .. oe:api::


      class oeostream : public oestream

   This class represents `oeostream`.

   Defines the platform independent interface and implementation for a
   generic output data stream class.

   The following methods are publicly inherited from :ref:`oestream <OEPlatform_oestream>`:

   ============================================================= ============================================================ ============================================================
   :oe:meth:`operator bool<OEPlatform::oestream::operator bool>` :oe:meth:`rewind<OEPlatform::oestream::rewind>`              :oe:meth:`tell<OEPlatform::oestream::tell>`                 
   :oe:meth:`eof<OEPlatform::oestream::eof>`                     :oe:meth:`seek<OEPlatform::oestream::seek>`                                                                              
   :oe:meth:`length<OEPlatform::oestream::length>`               :oe:meth:`size<OEPlatform::oestream::size>`                                                                              
   ============================================================= ============================================================ ============================================================


   The following classes derive from this class:
    * :ref:`oeofstream <OEPlatform_oeofstream>`
    * :ref:`oeogzstream <OEPlatform_oeogzstream>`
    * :ref:`oeosstream <OEPlatform_oeosstream>`
    * :ref:`oeostdstream <OEPlatform_oeostdstream>`
    * :ref:`oeowrapperstream <OEPlatform_oeowrapperstream>`
   
   .. oe:method:: Constructors

      .. oe:language:: c++ java csharp

         .. oe:api::

            oeostream()

      .. oe:language:: python

         .. oe:api:: python

            oeostream() -> oeostream
            oeostream(arg2: oeostream) -> oeostream

      Creates an instance of an :ref:`oeostream <OEPlatform_oeostream>`.
      This class is designed to
      provide an interface and some functionality; however, this class
      does not define a data target and therefore writing data to an
      instance of this is equivalent to writing to null.

   .. oe:method:: operator<<
      :language: c++

      .. oe:api::

         oeostream &operator<<(oestream &(_f)(oestream &))
         oeostream &operator<<(oeostream &(_f)(oeostream &))

      Use of these operators executes the specified function ('f') on
      the stream in question. In order for proper compilation and
      execution, the specified function must be prototyped according
      to the API shown above.

      .. oe:api::

         oeostream &operator<<(oeistream &)

      Fills the current stream by reading and storing all of the data 
      from the specified :ref:`oeistream <OEPlatform_oeistream>` stream.

      .. oe:api::

         oeostream &operator<<(int)
         oeostream &operator<<(bool)
         oeostream &operator<<(long)
         oeostream &operator<<(char)
         oeostream &operator<<(short)
         oeostream &operator<<(float)
         oeostream &operator<<(double)
         oeostream &operator<<(signed char)
         oeostream &operator<<(const char *)
         oeostream &operator<<(unsigned int)
         oeostream &operator<<(unsigned long)
         oeostream &operator<<(unsigned char)
         oeostream &operator<<(unsigned short)
         oeostream &operator<<(const signed char *)
         oeostream &operator<<(const std::string &)
         oeostream &operator<<(const unsigned char *)

      These operators take the specified parameter, convert it to a text
      representation, and then push it onto the current stream as a
      whitespace-delimited text token.



   .. oe:method:: close

      .. oe:language:: c++ java csharp

         .. oe:api::

            void close()

      .. oe:language:: python

         .. oe:api:: python

            close() -> None

      Flushes the remaining data in the output buffer and then closes the
      stream. After the stream has been closed, it is then initialized
      and ready to be opened. Before this stream can be reused, it must
      first be opened with :oe:meth:`OEPlatform::oeostream::open`. 
      Any attempts to write to this stream
      before it has been opened will fail.



   .. oe:method:: flush

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool flush()

      .. oe:language:: python

         .. oe:api:: python

            flush() -> bool

      Flushes the remaining data in the output buffer onto the stream and
      returns whether or not it was successful. Explicit calls to this
      function are only necessary when one needs to make sure that all of
      the data that has been stored in the output buffer is actually on
      the output stream at that time. The output buffer is automatically
      flushed when it becomes full.



   .. oe:method:: open

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool open(const char* name)
            bool open(const std::string& name)
            bool open(unsigned char* buffer, oesize_t len)

      .. oe:language:: python

         .. oe:api:: python

            open(name: str) -> bool
            open(buffer: str, len: oesize_t) -> bool

      Opens the output stream to the specified sources. Passing a 'name'
      parameter will result in invocation of a protected virtual method
      to appropriate handle the specified output source. Passing a
      pointer to a character buffer along with the buffer's size will
      result in the stream wrapping the 'buffer' and using that as the
      stream data destination. Returns whether or not data can now be
      written to the stream.


   .. oe:method:: putbyte

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool putbyte(char c)

      .. oe:language:: python

         .. oe:api:: python

            putbyte(c: str) -> bool

      Pushes the specified byte 'c' onto the output stream and returns
      whether or not this was successful.



   .. oe:method:: write

      .. oe:language:: c++ java csharp

         .. oe:api::

            oesize_t write(const char* buffer, oesize_t len)
            oesize_t write(const std::string& buffer, oesize_t len)
            oesize_t write(const signed char* buffer, oesize_t len)
            oesize_t write(const unsigned char* buffer, oesize_t len)

      .. oe:language:: python

         .. oe:api:: python

            write(buffer: str, len: oesize_t) -> oesize_t
            write(str: signed, len: oesize_t) -> oesize_t

      Writes 'len' number of bytes from the specified data source ('buffer')
      onto the output stream and returns the number of bytes that were
      able to be written.
