Example #1
0
def read_fixed(format_code, read):
    """Read a fixed-length value from an AMQP-encoded datastream.

    Args:
        read: a callable that accepts an integer as its argument, indicating
            the number of octets to be read from the stream, and returns
            a :class:`bytes` object of equal length to the input value.
        format_code (:class:`int`): an AMQP primitive type format
            code.

    Returns:
        bytes
    """
    return read(get_type_length(format_code))
 def width(self):
     return get_type_length(self.format_code)