Change Unpacker example to read from stream

This commit is contained in:
Joel Nothman 2012-12-06 23:01:12 +11:00
parent 6b78223231
commit caecc0098e

View file

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