Convert between bytestreams and higher-level AMQP types.
2007-11-05 Barry Pederson <bp@barryp.org>
Read higher-level AMQP types from a bytestream.
Read n bytes.
Read a single boolean value.
Read float value.
Read an unsigned 32-bit integer
Read an unsigned 64-bit integer
Read a string that’s up to 2**32 bytes.
The encoding isn’t specified in the AMQP spec, so assume it’s utf-8
Read one byte, return as an integer
Read an unsigned 16-bit integer
Read a short string that’s stored in up to 255 bytes.
The encoding isn’t specified in the AMQP spec, so assume it’s utf-8
Read an AMQP table, and return as a Python dictionary.
Read and AMQP timestamp, which is a 64-bit integer representing seconds since the Unix epoch in 1-second resolution.
Return as a Python datetime.datetime object, expressed as localtime.
Convert higher-level AMQP types to bytestreams.
Pass through if possible to any file-like destinations.
Pass through if possible to any file-like destinations.
Get what’s been encoded so far if we’re working with a BytesIO.
Write a plain Python string with no special encoding in Python 2.x, or bytes in Python 3.x
Write a boolean value.
Write an integer as an unsigned2 32-bit value.
Write an integer as an unsigned 64-bit value.
Write a string up to 2**32 bytes long after encoding.
If passed a unicode string, encode as UTF-8.
Write an integer as an unsigned 8-bit value.
Write an integer as an unsigned 16-bit value.
Write a string up to 255 bytes long (after any encoding).
If passed a unicode string, encode with UTF-8.
Write out a Python dictionary made of up string keys, and values that are strings, signed integers, Decimal, datetime.datetime, or sub-dictionaries following the same constraints.
Write out a Python datetime.datetime object as a 64-bit integer representing seconds since the Unix epoch.