# wx.StreamBase¶

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

It must not be used directly.

StreamBuffer

## Class Hierarchy¶

Inheritance diagram for class StreamBase:

## Methods Summary¶

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

## Class API¶

class wx.StreamBase(object)

Possible constructors:

StreamBase()


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

### Methods¶

__init__(self)

Creates a dummy stream object.

It doesn’t do anything.

GetLastError(self)

This function returns the last error.

Return type

wx.StreamError

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 InvalidOffset .

Return type

wx.FileOffset

New in version 2.5.4.

GetSize(self)

This function returns the size of the stream.

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

Return type

int

Warning

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

IsOk(self)

Returns True if no error occurred on the stream.

Return type

bool

IsSeekable(self)

Returns True if the stream supports seeking to arbitrary offsets.

Return type

bool

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).

Parameters

error (StreamError) –

### Properties¶

LastError

Length

Size