Phoenix Logo

phoenix_title wx.OutputStream

wx.OutputStream is an abstract base class which may not be used directly.

It is the base class of all streams which provide a Write function, i.e. which can be used to output data (e.g. to a file, to a socket, etc).

If you want to create your own output stream, you’ll need to derive from this class and implement the protected OnSysWrite function only.


class_hierarchy Class Hierarchy

Inheritance diagram for class OutputStream:

sub_classes Known Subclasses

CountingOutputStream , FFileOutputStream , FileOutputStream , FilterOutputStream , MemoryOutputStream , SocketOutputStream , StringOutputStream , TempFileOutputStream


method_summary Methods Summary

__init__ Creates a dummy wx.OutputStream object.
Close Closes the stream, returning False if an error occurs.
LastWrite Returns the number of bytes written during the last Write .
PutC Puts the specified character in the output queue and increments the stream position.
SeekO Changes the stream current position.
TellO Returns the current stream position.
Write Writes up to the specified amount of bytes using the data of buffer.
WriteAll Writes exactly the specified number of bytes from the buffer.
close  
eof  
flush  
seek  
tell  
write  

api Class API



class wx.OutputStream(StreamBase)

Possible constructors:

OutputStream()

OutputStream is an abstract base class which may not be used directly.


Methods



__init__(self)

Creates a dummy wx.OutputStream object.



Close(self)

Closes the stream, returning False if an error occurs.

The stream is closed implicitly in the destructor if Close is not called explicitly.

If this stream wraps another stream or some other resource such as a file, then the underlying resource is closed too if it is owned by this stream, or left open otherwise.

Return type:bool


LastWrite(self)

Returns the number of bytes written during the last Write .

It may return 0 even if there is no error on the stream if it is only temporarily impossible to write to it.

Return type:int


PutC(self, c)

Puts the specified character in the output queue and increments the stream position.

Parameters:c (int) –


SeekO(self, pos, mode=FromStart)

Changes the stream current position.

Parameters:
  • pos (wx.FileOffset) – Offset to seek to.
  • mode (SeekMode) – One of FromStart, FromEnd, FromCurrent.
Return type:

wx.FileOffset

Returns:

The new stream position or InvalidOffset on error.



TellO(self)

Returns the current stream position.

Return type:wx.FileOffset


Write(self, *args, **kw)

overload Overloaded Implementations:



Write (self, buffer, size)

Writes up to the specified amount of bytes using the data of buffer.

Note that not all data can always be written so you must check the number of bytes really written to the stream using LastWrite when this function returns.

In some cases (for example a write end of a pipe which is currently full) it is even possible that there is no errors and zero bytes have been written. This function returns a reference on the current object, so the user can test any states of the stream right away.

Parameters:
  • buffer
  • size (int) –
Return type:

wx.OutputStream



Write (self, stream_in)

Reads data from the specified input stream and stores them in the current stream.

The data is read until an error is raised by one of the two streams.

Parameters:stream_in (wx.InputStream) –
Return type: wx.OutputStream





WriteAll(self, buffer, size)

Writes exactly the specified number of bytes from the buffer.

Returns True if exactly size bytes were written. Otherwise, returns False and LastWrite should be used to retrieve the exact amount of the data written if necessary.

This method uses repeated calls to Write (which may return writing only part of the data) if necessary.

Parameters:
  • buffer
  • size (int) –
Return type:

bool

New in version 2.9.5.



close(self)


eof(self)
Return type:bool


flush(self)


seek(self, offset, whence=0)


tell(self)
Return type:wx.FileOffset


write(self, data)
Return type:PyObject