
.. oe:namespace:: OEPlatform



.. meta::
   :keywords: oestream, stream


.. _OEPlatform_oestream:

.. oe:class:: oestream

   .. oe:api::


      class oestream

   This class represents `oestream`.

   The :ref:`oestream <OEPlatform_oestream>` class is the base class which sets up the
   platform independent interface for streaming any type of data.
   

   The following classes derive from this class:
    * :ref:`oeifstream <OEPlatform_oeifstream>`
    * :ref:`oeigzstream <OEPlatform_oeigzstream>`
    * :ref:`oeisstream <OEPlatform_oeisstream>`
    * :ref:`oeistdstream <OEPlatform_oeistdstream>`
    * :ref:`oeistream <OEPlatform_oeistream>`
    * :ref:`oeiwrapperstream <OEPlatform_oeiwrapperstream>`
    * :ref:`oeofstream <OEPlatform_oeofstream>`
    * :ref:`oeogzstream <OEPlatform_oeogzstream>`
    * :ref:`oeosstream <OEPlatform_oeosstream>`
    * :ref:`oeostdstream <OEPlatform_oeostdstream>`
    * :ref:`oeostream <OEPlatform_oeostream>`
    * :ref:`oeowrapperstream <OEPlatform_oeowrapperstream>`
    * :ref:`oeprogressstream <OESystem_oeprogressstream>`
   
   .. oe:method:: Constructors

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

         .. oe:api::

            oestream()

      .. oe:language:: python

         .. oe:api:: python

            oestream() -> oestream

      Creates an instance of an :ref:`oestream <OEPlatform_oestream>`.
      This class exists solely to
      provide an interface, therefore, instances of this class have no
      independently meaningful functionality.

   .. oe:method:: operator bool

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

         .. oe:api::

            operator bool() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Evaluates the stream to a Boolean value based on whether the end of
      the stream has been reached. This is equivalent to ``!eof()``.



   .. oe:method:: eof

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

         .. oe:api::

            bool eof() const

      .. oe:language:: python

         .. oe:api:: python

            eof() -> bool

      Returns whether the end of the stream has been reached.

   .. oe:method:: length

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

         .. oe:api::

            oefpos_t length()

      .. oe:language:: python

         .. oe:api:: python

            length() -> oefpos_t

      Returns the number of bytes that have been read from or written
      to the stream in the last
      :oe:meth:`read<OEPlatform::oeistream::read>` or
      :oe:meth:`write<OEPlatform::oeostream::write>` call.

   .. oe:method:: rewind

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

         .. oe:api::

            bool rewind()

      .. oe:language:: python

         .. oe:api:: python

            rewind() -> bool

      Sets the data pointer position in the stream to the beginning of
      the stream.

   .. oe:method:: seek

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

         .. oe:api::

            bool seek(oefpos_t pos)
            bool seek(oefpos_t offset, seek_dir dir)

      .. oe:language:: python

         .. oe:api:: python

            seek(pos: oefpos_t) -> bool

      Sets the current position of the data pointer. This is accomplished
      by specifying the desired position or by specifying an offset
      distance and a directionality from the current
      position. Directionality is specified using the following
      enumeration:

      .. code-block:: c++

         enum seek_dir { beg = 0, cur = 1, end = 2 };

   .. oe:method:: size

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

         .. oe:api::

            oefpos_t size()

      .. oe:language:: python

         .. oe:api:: python

            size() -> oefpos_t

      If possible, returns the size of the stream in bytes. For
      :oe:cls:`oeostreams<OEPlatform::oeostream>` this is always
      ``zero``. 
      
      .. note:: 

         For :oe:cls:`oeistreams<OEPlatform::oeistream>` this may not
         be possible to calculate without reading, *e.g.*, when the
         stream is a socket or pipe. In this case the implementation
         may return ``0``. 

   .. oe:method:: tell

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

         .. oe:api::

            oefpos_t tell() const

      .. oe:language:: python

         .. oe:api:: python

            tell() -> oefpos_t

      Returns the current position of the data pointer in the
      stream. 

         
