GMime.Stream

g GMime.Stream GMime.Stream GObject.Object GObject.Object GObject.Object->GMime.Stream

Subclasses:

GMime.StreamBuffer, GMime.StreamCat, GMime.StreamFile, GMime.StreamFilter, GMime.StreamFs, GMime.StreamGIO, GMime.StreamMem, GMime.StreamMmap, GMime.StreamNull, GMime.StreamPipe

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

buffer_gets (buf)

buffer_readln (buffer)

close ()

construct (start, end)

eos ()

flush ()

length ()

read (buf)

reset ()

seek (offset, whence)

set_bounds (start, end)

substream (start, end)

tell ()

write (buf)

write_string (str)

write_to_stream (dest)

writev (vector)

Virtual Methods

Inherited:

GObject.Object (7)

do_close ()

do_eos ()

do_flush ()

do_length ()

do_read (buf)

do_reset ()

do_seek (offset, whence)

do_substream (start, end)

do_tell ()

do_write (buf)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

bound_end

int

r

bound_start

int

r

parent_object

GObject.Object

r

parent GObject.Object

position

int

r

super_stream

GMime.Stream

r

Class Details

class GMime.Stream(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

GMime.StreamClass

Abstract I/O stream class.

buffer_gets(buf)
Parameters:

buf (bytes) – line buffer

Returns:

the number of characters read into buf on success or %-1 on fail.

Return type:

int

Reads in at most one less than max characters from self and stores them into the buffer pointed to by buf. Reading stops after an EOS or newline (’\n’). If a newline is read, it is stored into the buffer. A ‘\0’ is stored after the last character in the buffer.

buffer_readln(buffer)
Parameters:

buffer (bytes) – output buffer

Reads a single line into buffer.

close()
Returns:

%0 on success or %-1 on fail.

Return type:

int

Closes the stream.

construct(start, end)
Parameters:
  • start (int) – start boundary

  • end (int) – end boundary

Initializes a new stream with bounds start and end.

eos()
Returns:

True on EOS or False otherwise.

Return type:

bool

Tests the end-of-stream indicator for self.

flush()
Returns:

%0 on success or %-1 on fail.

Return type:

int

Sync’s the stream to disk.

length()
Returns:

the length of the stream or %-1 if unknown.

Return type:

int

Gets the length of the stream.

read(buf)
Parameters:

buf (bytes) – buffer

Returns:

the number of bytes read or %-1 on fail.

Return type:

int

Attempts to read up to len bytes from self into buf.

reset()
Returns:

%0 on success or %-1 on fail.

Return type:

int

Resets the stream.

seek(offset, whence)
Parameters:
Returns:

the resultant position on success or %-1 on fail.

Return type:

int

Repositions the offset of the stream self to the argument offset according to the directive whence as follows:

GMime.SeekWhence.SET: Seek offset bytes relative to the beginning (bound_start) of the stream.

GMime.SeekWhence.CUR: Seek offset bytes relative to the current offset of the stream.

GMime.SeekWhence.END: Seek offset bytes relative to the end of the stream (bound_end if non-negative).

set_bounds(start, end)
Parameters:
  • start (int) – start boundary

  • end (int) – end boundary

Set the bounds on a stream.

substream(start, end)
Parameters:
  • start (int) – start boundary

  • end (int) – end boundary

Returns:

a substream of self with bounds start and end.

Return type:

GMime.Stream

Creates a new substream of self with bounds start and end.

tell()
Returns:

the current position within the stream or %-1 on fail.

Return type:

int

Gets the current offset within the stream.

write(buf)
Parameters:

buf (bytes) – buffer

Returns:

the number of bytes written or %-1 on fail.

Return type:

int

Attempts to write up to len bytes of buf to self.

write_string(str)
Parameters:

str (str) – string to write

Returns:

the number of bytes written or %-1 on fail.

Return type:

int

Writes string to self.

write_to_stream(dest)
Parameters:

dest (GMime.Stream) – destination stream

Returns:

the number of bytes written or %-1 on fail.

Return type:

int

Attempts to write the source stream to the destination stream.

writev(vector)
Parameters:

vector ([GMime.StreamIOVector]) – a GMime.StreamIOVector

Returns:

the number of bytes written or %-1 on fail.

Return type:

int

Writes at most count blocks described by vector to self.

do_close() virtual
Returns:

%0 on success or %-1 on fail.

Return type:

int

Closes the stream.

do_eos() virtual
Returns:

True on EOS or False otherwise.

Return type:

bool

Tests the end-of-stream indicator for stream.

do_flush() virtual
Returns:

%0 on success or %-1 on fail.

Return type:

int

Sync’s the stream to disk.

do_length() virtual
Returns:

the length of the stream or %-1 if unknown.

Return type:

int

Gets the length of the stream.

do_read(buf) virtual
Parameters:

buf (bytes) – buffer

Returns:

the number of bytes read or %-1 on fail.

Return type:

int

Attempts to read up to len bytes from stream into buf.

do_reset() virtual
Returns:

%0 on success or %-1 on fail.

Return type:

int

Resets the stream.

do_seek(offset, whence) virtual
Parameters:
Returns:

the resultant position on success or %-1 on fail.

Return type:

int

Repositions the offset of the stream stream to the argument offset according to the directive whence as follows:

GMime.SeekWhence.SET: Seek offset bytes relative to the beginning (bound_start) of the stream.

GMime.SeekWhence.CUR: Seek offset bytes relative to the current offset of the stream.

GMime.SeekWhence.END: Seek offset bytes relative to the end of the stream (bound_end if non-negative).

do_substream(start, end) virtual
Parameters:
  • start (int) – start boundary

  • end (int) – end boundary

Returns:

a substream of stream with bounds start and end.

Return type:

GMime.Stream

Creates a new substream of stream with bounds start and end.

do_tell() virtual
Returns:

the current position within the stream or %-1 on fail.

Return type:

int

Gets the current offset within the stream.

do_write(buf) virtual
Parameters:

buf (bytes) – buffer

Returns:

the number of bytes written or %-1 on fail.

Return type:

int

Attempts to write up to len bytes of buf to stream.