GMime.Encoding¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
encode |
r/w |
||
encoding |
r/w |
the type of encoding |
|
save |
r/w |
saved bytes from the previous step |
|
state |
r/w |
current encder/decoder state |
|
uubuf |
r/w |
a temporary buffer needed when uuencoding data |
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GMime.Encoding¶
A context used for encoding or decoding data.
- classmethod base64_decode_step(inbuf, inlen, outbuf, state, save)¶
- Parameters:
- Returns:
the number of bytes decoded (which have been dumped in outbuf).
- Return type:
Decodes a chunk of base64 encoded data.
- classmethod base64_encode_close(inbuf, inlen, outbuf, state, save)¶
- Parameters:
- Returns:
the number of bytes encoded.
- Return type:
Base64 encodes the input stream to the output stream. Call this when finished encoding data with
GMime.Encoding.base64_encode_step
() to flush off the last little bit.
- classmethod base64_encode_step(inbuf, inlen, outbuf, state, save)¶
- Parameters:
- Returns:
the number of bytes encoded.
- Return type:
Base64 encodes a chunk of data. Performs an ‘encode step’, only encodes blocks of 3 characters to the output at a time, saves left-over state in state and save (initialise to 0 on first invocation).
- classmethod quoted_decode_step(inbuf, inlen, outbuf, state, save)¶
- Parameters:
- Returns:
the number of bytes decoded.
- Return type:
Decodes a block of quoted-printable encoded data. Performs a ‘decode step’ on a chunk of QP encoded data.
- classmethod quoted_encode_close(inbuf, inlen, outbuf, state, save)¶
- Parameters:
- Returns:
the number of bytes encoded.
- Return type:
Quoted-printable encodes a block of text. Call this when finished encoding data with
GMime.Encoding.quoted_encode_step
() to flush off the last little bit.
- classmethod quoted_encode_step(inbuf, inlen, outbuf, state, save)¶
- Parameters:
- Returns:
the number of bytes encoded.
- Return type:
Quoted-printable encodes a block of text. Performs an ‘encode step’, saves left-over state in state and save (initialise to -1 on first invocation).
- classmethod uudecode_step(inbuf, inlen, outbuf, state, save)¶
- Parameters:
- Returns:
the number of bytes decoded.
- Return type:
Uudecodes a chunk of data. Performs a ‘decode step’ on a chunk of uuencoded data. Assumes the “begin mode filename” line has been stripped off.
- classmethod uuencode_close(inbuf, inlen, outbuf, uubuf, state, save)¶
- Parameters:
- Returns:
the number of bytes encoded.
- Return type:
Uuencodes a chunk of data. Call this when finished encoding data with
GMime.Encoding.uuencode_step
() to flush off the last little bit.
- classmethod uuencode_step(inbuf, inlen, outbuf, uubuf, state, save)¶
- Parameters:
- Returns:
the number of bytes encoded.
- Return type:
Uuencodes a chunk of data. Performs an ‘encode step’, only encodes blocks of 45 characters to the output at a time, saves left-over state in uubuf, state and save (initialize to 0 on first invocation).
- flush(inbuf, inlen, outbuf)¶
- Parameters:
- Returns:
the number of bytes written to outbuf.
- Return type:
Completes the incremental encode or decode of the input stream (see
GMime.Encoding.step
() for details).
- init_decode(encoding)¶
- Parameters:
encoding (
GMime.ContentEncoding
) – aGMime.ContentEncoding
to use
Initializes a
GMime.Encoding
state machine for decoding from encoding.
- init_encode(encoding)¶
- Parameters:
encoding (
GMime.ContentEncoding
) – aGMime.ContentEncoding
to use
Initializes a
GMime.Encoding
state machine for encoding to encoding.
- outlen(inlen)¶
- Parameters:
inlen (
int
) – an input length- Returns:
the maximum number of bytes needed to encode or decode a buffer of inlen bytes.
- Return type:
Given the input length, inlen, calculate the needed output length to perform an encoding or decoding step.
- reset()¶
Resets the state of the
GMime.Encoding
.
- step(inbuf, inlen, outbuf)¶
- Parameters:
- Returns:
the number of bytes written to outbuf.
- Return type:
Incrementally encodes or decodes (depending on self) an input stream by ‘stepping’ through a block of input at a time.
You should make sure outbuf is large enough by calling
GMime.Encoding.outlen
() to find out how large outbuf might need to be.