Fix Unpacker example in README

The example did not properly deserialize, since it was dropping bytes
from the input stream.
This commit is contained in:
Spiros Eliopoulos 2012-11-01 00:55:33 -04:00
parent 62e8f40024
commit 30233a5a99

View file

@ -52,14 +52,15 @@ stream.
buf.seek(0)
unpacker = msgpack.Unpacker()
while True:
data = buf.read(4)
unpacker = msgpack.Unpacker()
while True:
data = buf.read(16)
if not data:
break
unpacker.feed(buf.read(16))
for unpacked in unpacker:
print unpacked
unpacker.feed(data)
for unpacked in unpacker:
print unpacked
packing/unpacking of custom data type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^