bencode serialization is 800 lines!?  I wrote under 50 in Smalltalk.  In fact, I think it was less than half that.  (To be fair, you can do this by adding recursive methods to Streams, which already have infrastructure to deal with the external environment.)