.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.StreamBase:

==========================================================================================================================================
|phoenix_title|  **wx.StreamBase**
==========================================================================================================================================

This class is the base class of most stream related classes in wxWidgets.          

It must not be used directly. 







         



.. seealso:: :ref:`StreamBuffer`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>StreamBase</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.StreamBase_inheritance.png" alt="Inheritance diagram of StreamBase" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.StreamBase.html" title="wx.StreamBase" alt="" coords="5,5,128,35"/> </map> 
   </p>

|


|sub_classes| Known Subclasses
==============================

:ref:`wx.InputStream`, :ref:`wx.OutputStream`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.StreamBase.__init__`                                                  Creates a dummy stream object.
:meth:`~wx.StreamBase.GetLastError`                                              This function returns the last error.
:meth:`~wx.StreamBase.GetLength`                                                 Returns the length of the stream in bytes.
:meth:`~wx.StreamBase.GetSize`                                                   This function returns the size of the stream.
:meth:`~wx.StreamBase.IsOk`                                                      Returns ``True`` if no error occurred on the stream.
:meth:`~wx.StreamBase.IsSeekable`                                                Returns ``True`` if the stream supports seeking to arbitrary offsets.
:meth:`~wx.StreamBase.Reset`                                                     Resets the stream state.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.StreamBase.LastError`                                                 See :meth:`~wx.StreamBase.GetLastError`
:attr:`~wx.StreamBase.Length`                                                    See :meth:`~wx.StreamBase.GetLength`
:attr:`~wx.StreamBase.Size`                                                      See :meth:`~wx.StreamBase.GetSize`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.StreamBase(object)

   **Possible constructors**::

       StreamBase()
       
   
   This class is the base class of most stream related classes in
   wxWidgets.



   .. method:: __init__(self)

      Creates a dummy stream object.                  

      It doesn't do anything.                   





   .. method:: GetLastError(self)

      This function returns the last error.                  

      :rtype: :ref:`wx.StreamError`








   .. method:: GetLength(self)

      Returns the length of the stream in bytes.                  

      If the length cannot be determined (this is always the case for socket streams for example), returns :meth:`InvalidOffset` . 

                

      :rtype: :ref:`wx.FileOffset`







      .. versionadded:: 2.5.4 
     








   .. method:: GetSize(self)

      This function returns the size of the stream.                  

      For example, for a file it is the size of the file. 

                

      :rtype: `int`







      .. warning:: There are streams which do not have size by definition, such as socket streams. In that cases, :meth:`GetSize`   returns 0 so you should always test its return value.   








   .. method:: IsOk(self)

      Returns ``True`` if no error occurred on the stream.                  

                

      :rtype: `bool`







      .. seealso:: :meth:`GetLastError`     








   .. method:: IsSeekable(self)

      Returns ``True`` if the stream supports seeking to arbitrary offsets.                  

      :rtype: `bool`








   .. method:: Reset(self, error=STREAM_NO_ERROR)

      Resets the stream state.                  

      By default, resets the stream to good state, i.e. clears any errors. Since wxWidgets 2.9.3 can be also used to explicitly set the state to the specified error (the `error`  argument didn't exist in the previous versions). 

                


      :param `error`: 
      :type `error`: wx.StreamError






      .. seealso:: :meth:`GetLastError`     








   .. attribute:: LastError

      See :meth:`~wx.StreamBase.GetLastError`


   .. attribute:: Length

      See :meth:`~wx.StreamBase.GetLength`


   .. attribute:: Size

      See :meth:`~wx.StreamBase.GetSize`

