This library packs/unpacks string messages in byte stream. Protocol description: Int = '0' | '1'..'9' ['0'..'9']* decimal representation of integers without leading zeroes. Ver1: Stream = Message* End-of-stream Message = (Int as len) \x0A User-message \x0A \x0A where len is User-message length in bytes. One should not generate messages with length more than 10 digits. End-of-stream = \x0A Ver2: Stream = Message* End-of-stream Piece_len = \x20 (Int as piece_len) Piece_data = User-message \x0A Message = (Int as total_len) \x20 (Int as pieces_count) Piece_len* \x0A Piece_data* \x0A total_len is the length of all piece_len's (i.e. length of all Piece_data elements excluding their \x0A). One should not generate messages with total_len more than 10 digits. pieces_count is the count of Piece_len and Piece_data elements, it must be non-negative. Every piece_len must be the length of corresponding User-message in bytes.