Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/typedstream/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@
_TAG_INTEGER_2 = -127
# Indicates an integer value, stored in 4 bytes.
_TAG_INTEGER_4 = -126
# Indicates an integer value, stored in 8 bytes.
_TAG_INTEGER_8 = -121
# Indicates a floating-point value, stored in 4 or 8 bytes (depending on whether it is a float or a double).
_TAG_FLOATING_POINT = -125
# Indicates the start of a string value or an object that is stored literally and not as a backreference.
Expand Down Expand Up @@ -677,6 +679,8 @@ def _read_integer(self, head: typing.Optional[int] = None, *, signed: bool) -> i
return int.from_bytes(self._read_exact(2), self.byte_order, signed=signed)
elif head == _TAG_INTEGER_4:
return int.from_bytes(self._read_exact(4), self.byte_order, signed=signed)
elif head == _TAG_INTEGER_8:
return int.from_bytes(self._read_exact(8), self.byte_order, signed=signed)
else:
raise InvalidTypedStreamError(f"Invalid head tag in this context: {head} ({head & 0xff:#x})")

Expand Down