Returns a binary representation of the data encoded in AMQP format. :return: The encoded data :raise: :exc:`DataException` if there is a Proton error.
(self)
| 801 | return pn_data_encoded_size(self._data) |
| 802 | |
| 803 | def encode(self) -> bytes: |
| 804 | """ |
| 805 | Returns a binary representation of the data encoded in AMQP format. |
| 806 | |
| 807 | :return: The encoded data |
| 808 | :raise: :exc:`DataException` if there is a Proton error. |
| 809 | """ |
| 810 | size = 1024 |
| 811 | while True: |
| 812 | cd, enc = pn_data_encode(self._data, size) |
| 813 | if cd == PN_OVERFLOW: |
| 814 | size *= 2 |
| 815 | elif cd >= 0: |
| 816 | return enc |
| 817 | else: |
| 818 | self._check(cd) |
| 819 | |
| 820 | def decode(self, encoded: bytes) -> int: |
| 821 | """ |