Skip to main content

some serialisation functions

Project description

I use these functions to serialise and de-serialise non-negative integers of arbitrary size and run length encoded block data.

The integers are encoded as octets in big-endian order, with the high bit indicating that more octets follow.

  • get_bs(bs, offset=0): collect an integer from the bytes bs at the specified offset

  • get_bsdata(bs, offset=0): collect a run length encoded data block from the bytes bs at the specified offset

  • get_bsfp(fp): collect an integer from the binary file fp

  • put_bs(n): return the bytes encoding of the supplied integer n

  • put_bsdata(data): return the bytes run length encoding of the supplied data block

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs.serialise-20150116.tar.gz (2.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page