Skip to content

Instantly share code, notes, and snippets.

@xyzz
Created August 12, 2013 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyzz/cc4f71bacc8a63a53e53 to your computer and use it in GitHub Desktop.
Save xyzz/cc4f71bacc8a63a53e53 to your computer and use it in GitHub Desktop.
def read_something(stream, length):
return int.from_bytes(stream.read(length), byteorder="big")
def read_int(stream):
return read_something(stream, 4)
def read_byte(stream):
return read_something(stream, 1)
def read_short(stream):
return read_something(stream, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment