from typing import BinaryIO
from typing import cast
import struct


def read_short(stream: BinaryIO) -> int:
    """Read a short integer value in big-endian order."""
    return cast(int, struct.unpack('>h', stream.read(2))[0])