Add a stream codec

Not thoroughly tested yet
Convert update service to use stream codec
Document stream_codec