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:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
bound_end |
r |
||
bound_start |
r |
||
parent_object |
r |
parent |
|
position |
r |
||
super_stream |
r |
Class Details¶
- class GMime.Stream(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
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:
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.
- construct(start, end)¶
-
Initializes a new stream with bounds start and end.
- eos()¶
-
Tests the end-of-stream indicator for self.
- length()¶
- Returns:
the length of the stream or %-1 if unknown.
- Return type:
Gets the length of the stream.
- read(buf)¶
-
Attempts to read up to len bytes from self into buf.
- seek(offset, whence)¶
- Parameters:
offset (
int
) – positional offsetwhence (
GMime.SeekWhence
) – seek directive
- Returns:
the resultant position on success or %-1 on fail.
- Return type:
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)¶
-
Set the bounds on a stream.
- substream(start, end)¶
- Parameters:
- Returns:
a substream of self with bounds start and end.
- Return type:
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:
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:
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:
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:
Attempts to write the source stream to the destination stream.
- writev(vector)¶
- Parameters:
vector ([
GMime.StreamIOVector
]) – aGMime.StreamIOVector
- Returns:
the number of bytes written or %-1 on fail.
- Return type:
Writes at most count blocks described by vector to self.
- do_eos() virtual¶
-
Tests the end-of-stream indicator for stream.
- do_flush() virtual¶
- Returns:
%0 on success or %-1 on fail.
- Return type:
Sync’s the stream to disk.
- do_length() virtual¶
- Returns:
the length of the stream or %-1 if unknown.
- Return type:
Gets the length of the stream.
- do_read(buf) virtual¶
-
Attempts to read up to len bytes from stream into buf.
- do_seek(offset, whence) virtual¶
- Parameters:
offset (
int
) – positional offsetwhence (
GMime.SeekWhence
) – seek directive
- Returns:
the resultant position on success or %-1 on fail.
- Return type:
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:
- Returns:
a substream of stream with bounds start and end.
- Return type:
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:
Gets the current offset within the stream.