Skip to content

nekoknot/pybinstreamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

pybinstreamer

pybinstreamer is a simple and easy to use serializer. 'nuff said.

Example

from binstreamer import BinaryStream
from StringIO import StringIO
buf = StringIO("abcd")
stream = BinaryStream(buf)
print stream.read(4)
# abcd
stream.write("String, stored length", "s2")
stream.write(17000, "u16", "BE")  # Store 17000 as an unsigned 16-bit integer in Big Endian
stream.writeU8(255)  # Another way to interface
stream.seek(0)
print stream.read(4)
# abcd
print stream.read("s2")
# String, stored length
print stream.read("u16", "LE")
# 26690 (since we read in Little Endian and stored in Big Endian)
print stream.readI8()
# -1 (since we stored u8 and read i8)

About

Simple and easy to use serializer

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages